我已经使用 Git 一段时间了,但是不断要求输入密码开始让我感到厌烦。
我使用的是 Mac OS X 和 GitHub,并且按照 GitHub 的说明设置了 Git 和我的 SSH 密钥设置 Git 页面 http://help.github.com/mac-set-up-git/.
我还将 github SSH 密钥添加到我的 Mac OS X 钥匙串中,如上所述GitHub 的 SSH 密钥密码页面 http://help.github.com/ssh-key-passphrases/。我的公钥已在 Git 中注册。
尽管如此,每次我尝试 Git pull 时,我都必须输入我的用户名和密码。除了 SSH 密钥之外,我还需要为此设置其他东西吗?
我认为您可能有错误的 Git 存储库 URL。
Open .git/config
并找到 [remote "origin"] 部分。确保您使用的是 SSH:
ssh://[email protected] /cdn-cgi/l/email-protection/username/repo.git
如果单击,您可以在存储库的主页中看到 SSH URL克隆或下载并选择ssh.
而不是https
or git
one:
https://github.com/username/repo.git
git://github.com/username/repo.git
您现在可以验证justSSH 密钥而不是用户名和密码。
如果 Git 抱怨'origin' has already been added
, 打开.config
文件并编辑url = "..."
之后的部分[remote origin]
as url = ssh://github/username/repo.git
其他服务也是如此。确保地址如下所示:protocol://something@url
E.g. .git/config
for Azure 开发运营:
[remote "origin"]
url = https://[email protected] /cdn-cgi/l/email-protection/mystore/myproject/
fetch = +refs/heads/*:refs/remotes/origin/*
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)