我遇到了问题; git返回此警报:
The authenticity of host 'bitbucket.org (104.192.143.2)' can't be established.
RSA key fingerprint is SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1
Are you sure you want to continue connecting (yes/no)?
当我选择是时,它会返回:
Warning: Permanently added 'bitbucket.org,104.192.143.2' (RSA) to the list of known hosts.
ssh_packet_read: Connection closed
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有什么问题?
我必须在哪里添加RSA号码?拜托,我很绝望。 :(
答案 0 :(得分:8)
主持人的真实性bitbucket.org(104.192.143.2)'无法建立。 RSA密钥指纹为SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1您确定要继续连接(是/否)?
这是正常的,说是的,这是安全的。要求你确认,ssh过于偏执。您可以在ssh配置中将StrictHostKeyChecking
设置为no
来关闭它。
记住您连接的每台服务器的公钥是ssh的安全功能,可以保护您免受man-in-the-middle attack的攻击。它是这样的:
第一次向主机发送其公钥时(记住所有SHA256:zzXQ...
内容),通常在~/.ssh/known_hosts
中。
此后每次ssh都会检查同一主机是否仍在使用相同的密钥。这证实了bitbucket.org仍然是你第一次与之交谈的服务器。
如果按键不匹配则可能意味着两件事之一。首先是服务器管理员重新安装了他们的ssh服务器,忘了保持相同的密钥。这对于小型网站来说很常见,但对于像bitbucket.org这样的东西不太可能。
第二种可能性是ssh服务器已被劫持。这并不重要。一种常见的方法是流氓DNS服务器返回自己的恶意IP地址而不是bitbucket.org的真实地址。在公共wifi连接上很常见。
至于为什么它在确认后无法连接,它就在错误信息中。
$ git clone git@bitbucket.org:RobeJablonski/sda-robert.git
Cloning into 'sda-robert'...
conq: repository access denied.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
存储库存在,可以验证,因此您没有访问权限(我也没有)。 Bitbucket确定您使用ssh密钥的人。这意味着您没有使用正确的密钥登录。它必须与您在BitBucket上的帐户相关联的密钥相同。
您可以在https://bitbucket.org/account/user/ / ssh-keys /下的Bitbucket设置中找到您的BitBucket ssh密钥。然后你必须检查ssh是否正在使用该密钥。您可以使用ssh -v git@bitbucket.org
查看其使用情况。它会发出很多东西,但你正在寻找debug1: Offering RSA public key: /Users/blah/.ssh/blah
的最后一个例子。
找到后,检查/Users/blah/.ssh/blah.pub
是否与BitBucket认为您的ssh密钥相匹配。如果他们不匹配,那么您必须找到匹配的密钥configure ssh to use that key for bitbucket.org。
如果您丢失了密钥,则应更改bitbucket.org上的ssh密钥。
答案 1 :(得分:3)
您需要在要连接到GitHub或Bitbucket的计算机上创建SSH密钥,然后将该密钥添加到您的在线帐户。您可以通过以下方式执行此操作:
https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html
答案 2 :(得分:2)
cd ~/.ssh/
ssh-keygen
cat ~/.ssh/id_rsa.pub
sudo apt install git
SETTINGS -> Access keys -> Add key
https://bitbucket.org/compassitesinc/your-repository/admin/access-keys/
SETTINGS -> User and group access
添加具有管理员权限的电子邮件地址
cd /var/www/html/
git clone git@bitbucket.org:organization_name/repo_application.git repo_application