Nic*_*oul 171 git ssh bitbucket
我按照说明~/.ssh/id_rsa.pub将我上传到Bitbucket的SSH密钥,但Git仍然要求我在每次操作时都输入密码(例如).我错过了什么?git pull
它是一个私有存储库(另一个人的私有存储库的分支),我克隆它像这样:
git clone git@bitbucket.org:Nicolas_Raoul/therepo.git
Run Code Online (Sandbox Code Playgroud)
这是我当地的.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
Run Code Online (Sandbox Code Playgroud)
在具有相同公钥的相同环境中,Gitub上的Git工作正常.
.ssh是rwx------,.ssh/id_rsa是-rw-------,.ssh/id_rsa.pub是-rw-r--r--
man*_*lds 247
你确定你使用ssh url克隆它吗?
原点的网址是url = https://Nicolas_Raoul@bitbucket.org/Nicolas_Raoul/therepo.git这样说的,如果它使用https,它会询问密码而不管你的ssh密钥.
shi*_*mar 19
它已经在上面回答了.我将总结上面要检查的步骤.
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 以验证更改的远程URL.
参考:https://help.github.com/articles/changing-a-remote-s-url/
Vin*_*Ram 18
如果您使用的是 Ubuntu 系统,请使用以下命令永久存储密码:
git config --global credential.helper store
Run Code Online (Sandbox Code Playgroud)
Sve*_* W. 10
在HTTP请求的情况下,也可以将凭证(带密码)直接粘贴到URL中:
http://username:password@bitbucket.org/...
Run Code Online (Sandbox Code Playgroud)
这将节省痛苦,每次再次提供您的凭据.简单修改你的.git/config(url).
你好未来的Google员工.
在MacOS> = High Sierra上,由于各种原因,SSH密钥不再保存到KeyChain .
使用ssh-add -K不再存在重启.
这是3种可能的解决方案.
我成功地使用了第一种方法.我创建了一个名为文件config中~/.ssh:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
这些答案均无济于事,事实证明我的问题略有不同。每次发送密码之前,都是ssh要求我输入密码。因此,我要做的就是将密码与此命令关联:
ssh-add -K ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
然后,它将提示您输入密码并进行存储。如果每次提示您输入密码时,这可能是您正在寻找的解决方案
输入密钥'/Users//.ssh/id_rsa'的密码:
更多信息在这里
注意:我在Mac机器上成功使用了此功能,但是正如下面的@Rob Kwasowski指出的那样,大写K选项对于mac是唯一的。如果不在Mac上,则需要使用小写字母k(这可能也适用于mac,但我尚未测试)。
步骤1:安装git-credential-winstore
https://confluence.atlassian.com/bitbucketserver/permanently-authenticating-with-git-repositories-776639846.html
步骤2:git config --global credential.helper'cache --timeout 3600'
这将存储您的密码1小时
| 归档时间: |
|
| 查看次数: |
104147 次 |
| 最近记录: |