我将我的~/.ssh/id_rsa.pub
作为explained上传到了Bitbucket's SSH keys上,但每次操作(比如git pull
)时,Git还是会要求我提供密码。我错过了什么吗?
它是一个私有存储库(另一个人的私有存储库的分支),我是这样克隆它的:
git clone git@bitbucket.org:Nicolas_Raoul/therepo.git
这是我本地的.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
[branch "master"]
remote = origin
merge = refs/heads/master
在使用相同公钥的相同环境中,Github上的Git运行良好。
.ssh
为rwx------
,.ssh/id_rsa
为-rw-------
,.ssh/id_rsa.pub
为-rw-r--r--
发布于 2011-12-22 15:35:34
您确定是使用ssh url克隆的吗?
源的url是url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
,所以如果它使用https,它将要求输入密码,而不管您的ssh密钥是什么。
因此,您要做的是:
在当前存储库中打开配置文件。
vim .git/config
中的url更改行
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
至
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@bitbucket.org:Nicolas_Raoul/therepo.git
发布于 2016-05-31 04:24:11
上面已经回答了这个问题。我将总结上面要检查的步骤。
在项目目录中运行git remote -v
。如果输出显示远程url以https://abc
开头,那么您可能每次都需要用户名和密码。
因此,要更改远程url,请运行git remote set-url origin {ssh remote url address starts with mostly git@bitbucket.org:}
。
现在运行git remote -v
来验证更改后的远程url。
参考:https://help.github.com/articles/changing-a-remote-s-url/
发布于 2018-05-02 16:57:45
大家好,来自未来的谷歌人。
在MacOS >=高SSH上,KeyChain密钥不再保存到because of reasons。
使用ssh-add -K
也无法在重启中幸存下来。
我已经成功地使用了第一种方法。我在~/.ssh
中创建了一个名为config
的文件
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
https://stackoverflow.com/questions/8600652
复制相似问题