将存储库从 github 迁移到本地文件系统?
我在 github 上有一个 git 存储库。
我想将存储库的主版本迁移到本地文件系统,并从该本地文件系统副本进行克隆。
我该怎么做?
I have a git repository on github.
I would like to migrate the master version of the repository to a local filesystem, and clone from this local filesystem copy.
How do I do so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,通过克隆 github 存储库来创建新存储库:
如果要删除 github 存储库,请转至
https://github.com///edit
。页面底部有删除存储库的链接。然后设置要共享的新存储库:
http://www.google。 com/search?q=serving+a+git+repository
最后,在 github 存储库的所有其他克隆上,更改源 URL:
First, create your new repository by cloning your github repository:
If you want to delete your github repository, go to
https://github.com/<User Name>/<Project Name>/edit
. At the bottom of the page, there is link to delete the repository.Then setup your new repository to be shared:
http://www.google.com/search?q=serving+a+git+repository
Finally, on all other clones of the github repository, change the url of origin:
使用 Git 时没有“主”存储库,因此您所需要做的就是从 Github 中
git clone
存储库,然后从本地存储库克隆。当然,您无法指示 Github 从本地存储库中提取内容,因此您仍然需要使用 git Push 将任何更改推送到 Github。但是,这样做并不会使 Github 存储库比您本地的存储库更权威。
当您
git克隆
存储库时,Git会设置“原始”远程(请参阅git remote
) 指向您刚刚克隆的存储库。所以,如果你有一个github存储库G,并克隆到本地存储库A,然后将A克隆到另一个存储库B,那么B的“origin”将指向A,而不是G。您可以随时更改“origin”指向的内容使用 git Remote 命令。
There is no "master" repository when using Git, so all you need to do is
git clone
the one from Github, and then clone from your local repository.Of course you can't instruct Github to pull from your local repository, so you will still need to use
git push
to push any changes to Github. However, doing so doesn't make the Github repository any more authoritative than your local one.When you
git clone
a repository, Git sets up the "origin" remote (seegit remote
) to point to the repository you just cloned from. So, if you have a github repository G, and clone to a local repository A, then clone A to another repository B, then B's "origin" will point to A, not to G.You can always change what the "origin" points to using the
git remote
command.