Preserve git remotes

别说谁变了你拦得住时间么 提交于 2019-12-23 07:31:19

问题


I have fixed network of git remotes and I would like them to be attached to repository. Unfortunately git-clone doesn't clone remotes. Is there a way around it?


回答1:


I begin this command

https://github.com/juanpabloaj/git-remote-init

for save the remotes in a .gitremotes file




回答2:


There is no way to do this with git, as far as I know.

Telling users to run scripts post-clone is what people tend to do. If it's a ruby project, you probably have rake, for example, so you could have a rake post_install task.




回答3:


Remotes are saved in .git/config file of a repo, you can extract your favorites and append them on every clone.




回答4:


You could define them in your global config file ~/.gitconfig instead of your project's .git/config. Be careful though... if you run git remote update in a project it will pull down all remotes, even for repositories completely unrelated to the one you're working on.



来源:https://stackoverflow.com/questions/1572190/preserve-git-remotes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!