![](/img/trans.png)
[英]Can Git pull from one Subversion repository and push to another Subversion repository?
[英]How to configure git to pull from one repository and push to another
我有两个远程存储库:一个主存储库和一个fork,并希望从主repo中提取新的更改并推送到我的fork,以便我可以创建对主repo的pull请求。
我知道使用git remote add <name> <url>
添加两个遥控器是可行的,但我不想明确地执行git pull <main_repo>
和git push <fork_repo>
git remote set-url --push origin <fork_repo>
执行此操作后,您可以使用此命令检查URL
git remote -v
你会看到类似的东西
origin <main_repo> (fetch)
origin <fork_repo> (push)
解决方案是将主存储库添加为“origin”远程:
git remote add origin <main_repository_url>
或者如果已经存在:
git remote set-url origin <main_repository_url>
然后将fork设置为远程的push url:
git remote set-url --push origin <fork_repository_url>
只是为了检查结果:
$ git remote -v
origin <main_repository_url> (fetch)
origin <fork_repository_url> (push)
现在可以从主存储库中提取/签出分支并将更改推送到分支。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.