Bitbucket 上的 Git:总是要求输入密码,即使在上传了我的公共 SSH 密钥之后 [英] Git on Bitbucket: Always asked for password, even after uploading my public SSH key

查看:11
本文介绍了Bitbucket 上的 Git:总是要求输入密码,即使在上传了我的公共 SSH 密钥之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的 ~/.ssh/id_rsa.pub 上传到 Bitbucket 的 SSH键解释a>,但 Git 仍然会在每次操作时询问我的密码(例如 git pull).我错过了什么吗?

I uploaded my ~/.ssh/id_rsa.pub to Bitbucket's SSH keys as explained, but Git still asks me for my password at every operation (such as git pull). Did I miss something?

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

It is a private repository (fork of another person's private repository) and I cloned it like this:

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运行良好.
.sshrwx------.ssh/id_rsa-rw-------, .ssh/id_rsa.pub-rw-r--r--

In the same environment with the same public key, Git on Github works fine.
.ssh is rwx------, .ssh/id_rsa is -rw-------, .ssh/id_rsa.pub is -rw-r--r--

推荐答案

你确定你是用 ssh url 克隆的吗?

Are you sure you cloned it using the ssh url?

来源的 url 说 url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git 所以如果它使用 https,它会要求输入密码,而不管你的 ssh 密钥.

The url for origin says url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git so if it is using https it will ask for password irrespective of your ssh keys.

所以你想做的是:

在当前存储库中打开配置文件..

open your config file in your current repo ..

vim .git/config

并更改带有 url 的行

and change the line with the url from

[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

这篇关于Bitbucket 上的 Git:总是要求输入密码,即使在上传了我的公共 SSH 密钥之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆