首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Bitbucket上的Git :总是要求提供密码,即使在上传我的公共SSH密钥之后也是如此

Bitbucket上的Git :总是要求提供密码,即使在上传我的公共SSH密钥之后也是如此
EN

Stack Overflow用户
提问于 2011-12-22 15:28:48
回答 11查看 136.8K关注 0票数 202

我将我的~/.ssh/id_rsa.pub作为explained上传到了Bitbucket's SSH keys上,但每次操作(比如git pull)时,Git还是会要求我提供密码。我错过了什么吗?

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

代码语言:javascript
复制
git clone git@bitbucket.org:Nicolas_Raoul/therepo.git

这是我本地的.git/config

代码语言:javascript
复制
[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运行良好。

.sshrwx------.ssh/id_rsa-rw-------.ssh/id_rsa.pub-rw-r--r--

EN

回答 11

Stack Overflow用户

回答已采纳

发布于 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更改行

代码语言:javascript
复制
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git

代码语言:javascript
复制
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@bitbucket.org:Nicolas_Raoul/therepo.git
票数 295
EN

Stack Overflow用户

发布于 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/

票数 23
EN

Stack Overflow用户

发布于 2018-05-02 16:57:45

大家好,来自未来的谷歌人。

在MacOS >=高SSH上,KeyChain密钥不再保存到because of reasons

使用ssh-add -K也无法在重启中幸存下来。

这里是3 possible solutions

我已经成功地使用了第一种方法。我在~/.ssh中创建了一个名为config的文件

代码语言:javascript
复制
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_rsa
票数 18
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8600652

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档