Git Bitbucket:即使在上传我的公共SSH密钥后总是要求input密码

我按照说明将我的~/.ssh/id_rsa.pub上传到了Bitbucket的SSH密钥 ,但是Git在每次操作(例如git pull )时仍然要求我input密码。 我错过了什么?

这是一个私人存储库(另一个人的私人存储库的叉),我克隆它是这样的:

 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 

在具有相同公钥的相同环境中,Git上的Git工作正常。
.sshrwx------ .ssh/id_rsa-rw------- .ssh/id_rsa.pub-rw-r--r--

你确定你使用ssh url克隆它吗?

原始的URL说: url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git所以如果它使用https,它会要求input密码,不pipe你的ssh密钥。

正如这里所解释的那样,如果您使用SSH url进行克隆,则每次推/拉时都不需要input用户名/密码。 检查以上答案 @manojlds

但是,如果要使用HTTPS进行克隆,并且每次都要避免input用户名/密码,则可以使用以下命令将凭据存储到caching中:

git config --global credential.helper 'cache --timeout 3600'

其中3600(秒)表示1小时,您可以根据您的要求更改。

在HTTP请求的情况下,也可以将凭证(使用密码)直接粘贴到URL中:

 http://username:password@bitbucket.org/... 

这将节省痛苦,再次给你的凭据。 简单的修改你的.git / config(url)。

它已经在上面回答了。 我将总结上面检查的步骤。

在项目目录中运行git remote -v 。 如果输出显示以https://abc开头的远程URL,那么您可能每次都需要用户名密码。

所以要更改远程URL运行git remote set-url origin {ssh remote url address starts with mostly git@bitbucket.org:}

现在运行git remote -v来validation更改的远程URL。

请参阅: https : //help.github.com/articles/changing-a-remote-s-url/