【发布时间】:2016-01-06 03:50:09
【问题描述】:
我搜索了一下,找到了 some simular 主题,但没有适合我的解决方案
我在 Bitbucket 上有一些存储库,一些是私有的,一些是团队的。我创建了一个以团队 (nskiv) 作为所有者的新存储库 (webroot)。我用git remote add origin git@bitbucket.org:nskiv/webroot.git添加了这个本地
我添加了一些文件并将它们推送到存储库。然后我连接到我的服务器,当我尝试拉时,我不断地输入我的密码。当我这样做时,它工作正常,但它很烦人且不必要。
奇怪的是,我在任何地方都没有使用 HTTPS 链接。我本地的.git/config 是这样的:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@bitbucket.org:nskiv/webroot.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
在我的服务器上,我使用我的用户名 (maurice) 登录并将我的密钥复制 (cat /home/maurice/.ssh/id_rsa.pub | pbcopy) 到团队的 SSH 密钥设置。
当我尝试克隆 repo (git clone git@bitbucket.org:nskiv/webroot.git) 时,我必须输入我的密码。但为什么呢?
编辑:
解决方案是使用 eval "$(ssh-agent -s)" 激活 ssh 代理 一步我忘了配置我的服务器
【问题讨论】:
-
你的私钥有密码吗?你有运行 SSH 代理吗?
ssh git@bitbucket.org -v的输出是什么? -
@robert 谢谢我刚刚重新创建了没有密码的 ssh 密钥,我不必再输入密码了!