我已按照说明~/.ssh/id_rsa.pub
将我上传到Bitbucket的SSH密钥,但是Git在每次操作(例如)时仍会要求我提供密码。我错过了什么?git pull
它是一个私有存储库(另一个人的私有存储库的叉子),我将其克隆为:
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--
你确定使用ssh url克隆了它吗?
原始网址表示,url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git
因此,如果使用的是https,则无论输入的ssh密钥如何,都会要求输入密码。
因此,你需要执行以下操作:
在你当前的仓库中打开你的配置文件。
vim .git/config
并更改网址为
[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
您说得对,谢谢!我很可能使用错误的URL进行了克隆。我更换了网址中
.git/config
有git@bitbucket.org:Nicolas_Raoul/therepo.git
和现在的作品!和用来改变远程用git stackoverflow.com/questions/2432764/...
创建存储库时,是谁建议我使用https url是bitbucket!怎么来的!
请记住,如果您的位桶是私有的,则要使用git协议,则需要在设置中将ssh密钥添加到BitBuket的网站。
不得不将URL更改为
ssh://git@bitbucket.org/userName/repoName.git
-没有ssh://
前缀就没有用。