我把我的工作推到一个远程git存储库。
每次推送都会提示我输入用户名和密码。我想避免它的每一个推送,但如何配置以避免它?
我把我的工作推到一个远程git存储库。
每次推送都会提示我输入用户名和密码。我想避免它的每一个推送,但如何配置以避免它?
当前回答
将git客户端连接到操作系统凭据存储。例如,在Windows中,您将凭据帮助器绑定到wincred:
git config --global credential.helper wincred
在GitHub上使用https://时是否有办法跳过密码输入?
其他回答
在Windows操作系统上使用这个代替,这对我来说是有效的:
https://{Username}:{Password}@github.com/{Username}/{repo}.git
e.g.
git clone https://{Username}:{Password}@github.com/{Username}/{repo}.git
git pull https://{Username}:{Password}@github.com/{Username}/{repo}.git
git remote add origin https://{Username}:{Password}@github.com/{Username}/{repo}.git
git push origin master
在我的例子中,使用SSH,在将公钥添加到GitHub之后,然后将远程设置为git@github.com/username/reponame.git之类的东西,以及在本地永久添加私钥。本地命令如下:
ssh-add
ssh-add - k
我想有些人可能忽略了后一步。
看起来,至少在Windows上使用TortoiseGIT时,可以创建SSH密钥并将其传输到GIT服务器,只需使用:
> ssh-keygen.exe
> ssh-copy-id [username]@[GIT_server]
我使用的是https链接(https://github.com/org/repo.git) 而不是SSH链接;
git@github.com:org/repo.git
转换为我解决了这个问题!
只需使用——repo选项git push命令。是这样的:
$ git push --repo https://name:password@bitbucket.org/name/repo.git