将现有的 git 存储库推送到 gitolite
我已经在 Ubuntu 服务器上设置了 gitolite,并且可以添加用户、创建空存储库、克隆空存储库、添加文件、本地提交以及 git Push origin master 将其发送到 gitolite。
我还可以在 XCode4 中创建一个具有自己的 git 存储库的项目,并在本地提交更改。
现在我想在 gitolite 中有另一个副本(可能这样其他人可以使用,但也可以作为另一个副本)。这就是我陷入困境的地方,我是 git 的完全新手(只真正使用过 XCode git 功能)。有人可以指导我吗?
I've set up gitolite on my Ubuntu server and can add users, create empty repositories, clone the empty repository, add files, commit locally, and git push origin master
to send it to gitolite.
I can also create a project in XCode4, with its own git repository, and commit changes locally.
Now I want to have another copy in gitolite (possibly so others can use, but also as another copy). This is where I'm stuck, and I'm a complete newbie to git (only really have used the XCode git functionality). Can someone direct me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要向现有存储库添加另一个遥控器:
这些值将根据您的需要进行更改:
当您想要推送到原点时,您可以像往常一样这样做。当你想推送到新的遥控器时,你只需执行以下操作:
You need to add another remote to your existing repository:
These values will be changed to suit your needs:
When you want to push to origin, you can do that as you always have. When you want to push to the new remote you just do:
使用 User1578 提供的信息,我能够将现有存储库添加到我的开发服务器的 gitolite 存储库中。
涉及的步骤:
[remote "origin"]
url
更改为我的 gitolite 存储库。git push origin master
您的设置可能有所不同,但我不需要(或想要)另一个分支/远程。无论如何,旧的原始遥控器已经死了,所以我不需要保留它。希望这对其他人有帮助。
Using the information provided by User1578, I was able to add an existing repo to my development server's gitolite repo.
Steps involved:
[remote "origin"]
url
to my gitolite repo.git push origin master
Your set up may be different, but I did not need (or want) another branch/remote. The old origin remote was dead anyway, so I did not need to keep it. Hope this helps someone else.
在克隆的存储库中打开 CLI 并更改远程 url。例如:
git Remote set-url origin [email protected]:YOUR_NEW_REPO
运行:
git推送
Open CLI in the cloned repository and change the remote url. e.g:
git remote set-url origin [email protected]:YOUR_NEW_REPO
Run:
git push