【发布时间】:2021-09-05 23:42:47
【问题描述】:
我别无选择,我必须将 git clone 与 ssh 一起使用,所以之后当我使用 composer install 时,它将使用 git clone ssh 从 bitbucket 下载一些依赖项 当我尝试使用 SSH 运行 git clone 时,
git clone git@bitbucket.org:namespace/project.git
我得到这个输出
Cloning into 'project'...
The authenticity of host 'bitbucket.org (104.192.141.1)' can't be established.
RSA key fingerprint is SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/user/.ssh' (No such file or directory).
Failed to add the host to the list of known hosts (/home/user/.ssh/known_hosts).
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我不知道从哪里得到 RSA 密钥指纹SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
当使用命令行 ssh-keygen 生成私钥和公钥时,我得到了 RSA 密钥指纹SHA256:xV8l3qRhTRnFgRrZly1+ygQP9fqoANzqbuaYAVO1j9M
我还在bitbucket账户里加了公钥,加了一行known_hosts(bitbucket.org,104.192.141.1 ssh-rsa public key...),还是没用。
【问题讨论】:
-
我很高兴知道,我也有同样的问题 plzzz
-
您使用的是 GitBash 还是 Cygwin?目录
/home/user/.ssh真的存在吗? -
我使用的是 windows,是的,我使用的是 GitBash
-
您是否处于将 %userprofile% 路径设置为网络驱动器的公司环境中?默认情况下,在 Windows 中,创建的 SSH 密钥将存储在 C:\users\[您的用户]\.ssh 中。这应该是映射到上面输出中的“/home/[your user]/.ssh”路径的内容。该消息表明 .ssh 目录无法找到且无法创建 - 如果您的 Git Bash 无法创建该目录,您可以尝试手动创建该目录。根据我的经验,它是在 %userprofile% 目录中创建的。 ! :)
-
是的 .ssh 目录确实存在,并且 /home/[user]/.ssh 在使用 ssh-keygen 和 ssh-keyscan bitbucket 等命令时指向 c:/users/[user]/.ssh。 org 两个命令都有效
标签: git ssh bitbucket git-bash git-clone