从git 1.6.4起,有了一个新的控制选项——remote.$name.pushurl
,官方解释如下:
“git push $name” honors remote.$name.pushurl if present before using remote.$name.url. In other words, the URL used for fetching and pushing can be different.
也就是说,你可以有一个url用来取,一个url用来提交,下面是一个配置的例子
[remote "gitweb"] pushurl = ssh://me@example.com/gitrepo/mypj.git url = git://example.com/mypj.git fetch = +refs/heads/*:refs/remotes/gitweb/*