我在我的项目中使用 GIT。现在我想将它与github集成,所以我创建了一个远程:
git remote add github https://[email protected] /cdn-cgi/l/email-protection/WouterJ/project.git
但现在我需要填写一个密码来获取,这是我不想要的。所以我决定使用不同的 url 来获取:
git remote set-url github http://github.com/WouterJ/project.git
git remote set-url --push github https://[email protected] /cdn-cgi/l/email-protection/WouterJ/project.git
如果我跑git remote -v
我明白了:
$ git remote -v
github http://github.com/WouterJ/project.git (fetch)
github https://[email protected] /cdn-cgi/l/email-protection/WouterJ/project.git (push)
origin http://github.com/WouterJ/project.git (fetch)
origin http://github.com/WouterJ/project.git (push)
我想,正是我想要的。但是当我进行推送时,我需要填写我的用户名。为什么?如果我直接推送到填写的网址,它会完美地工作:
git push https://[email protected] /cdn-cgi/l/email-protection/WouterJ/project.git master
有效,但是
git push github master
行不通
我也用过git config
设置不同的推送 URL:
git config remote.github.pushurl https://[email protected] /cdn-cgi/l/email-protection/WouterJ/project.git
如果我从配置中获取pushurl,它看起来是正确的:
$ git config remote.github.pushurl
https://[email protected] /cdn-cgi/l/email-protection/WouterJ/project.git
另外查看 .git/config 文件,看起来一切都是正确的。
我在这里错过了什么吗?这是一个错误吗?我用的是Git1.7.4,有错吗?