我想在推送时设置我的密码而不是拉。
有没有办法做到这一点?
答案 0 :(得分:2)
如果您有两种不同的方式与远程存储库进行交互,其中一种方法需要密码(用于推送),而其中一种方法不需要(用于提取),您可以这样做:
[remote "origin"]
# the lightweight git protocol doesn't use passwords
# this will be used for fetch/pull
url = "git://git.foobar.org/foobar"
# this line is there by default; don't mess with it
fetch = +refs/heads/*:refs/remotes/origin/*
# SO, that's not a C comment... */
# ssh requires password/key
# this will be used for pushes
pushurl = ssh://user@foobar.org/foobar
在那里替换正确的网址,你应该好好去。