我上传了我的~/.ssh/id_rsa。但是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 - r -------, . ssh / id_rsa。Pub是-rw-r——r——


当前回答

这里的关键字是'ssh://'而不是https://':-)

在你的。git/config中

请注意!如果你已经克隆了存储库,在你将你的公钥添加到BitBucket后,这些存储库可以重新克隆。这可能比侵入你的配置文件更干净;-)

其他回答

这里的关键字是'ssh://'而不是https://':-)

在你的。git/config中

请注意!如果你已经克隆了存储库,在你将你的公钥添加到BitBucket后,这些存储库可以重新克隆。这可能比侵入你的配置文件更干净;-)

在HTTP请求的情况下,也可以直接将凭据(带密码)粘贴到url中:

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

这样就省去了每次都要提交你的证书的麻烦。简单地修改你的.git/config (url)。

您可能需要仔细检查您的SSH身份文件。你可能会引导BitBucket查看你在BitBucket中保存的等效公钥的不同/不正确的私钥。

用尾巴检查~/。Ssh /config -你会看到类似的东西:

Host bitbucket.org
 HostName bitbucket.org
 IdentityFile ~/.ssh/personal-bitbucket-ssh-key

请记住,添加额外的身份(如工作和家庭)可以通过ssh-add命令完成,例如:

ssh-keygen -t rsa -C "companyName" -f "companyName"
ssh-add ~/.ssh/companyName

一旦你确认了哪个私钥在本地被查看,你就可以获取你的公共等价密钥,在这种情况下:

cat ~/.ssh/personal-bitbucket-ssh-key.pub | pbcopy

然后把密码粘贴到BitBucket上。你的git推送现在将被允许(前提是你使用的是前面提到的答案所指出的SSH克隆)没有密码,因为你的设备是一个公认的友好。

希望这能帮你弄清楚。

与我,虽然我运行'git克隆ssh://git@stash.xxx.com:7999/projName/projA.git' 我仍然被提示输入我克隆的这个新回购的密码,所以通过比较它的.git/配置文件与其他工作的回购,它原来是[远程“origin”]部分下的url,它被设置为ssh路径上面的新回购,但被设置为https:xxx的工作。

步骤1:安装git-credential-winstore https://confluence.atlassian.com/bitbucketserver/permanently-authenticating-with-git-repositories-776639846.html 步骤2:git配置——global credential。Helper '缓存超时3600' 这将存储您的密码1小时 步骤3:执行git命令 这将提示您输入密码,并提示凭据 并保存密码