简体   繁体   English

Git 克隆使用 ssh 不适用于消息“git@github.com:没有这样的文件或目录”

[英]Git clone using ssh does not work with message "git@github.com: No such file or directory"

I'm trying to clone a private Github repo from my linux Mint computer using ssh.我正在尝试使用 ssh 从我的 linux Mint 计算机克隆私有 Github 存储库。 I have created a private/public key pair and registered it with Github (different than the default id_rsa).我创建了一个私钥/公钥对并将其注册到 Github(不同于默认的 id_rsa)。 When I try ssh -vT git@github.com , I have successful authentication.当我尝试ssh -vT git@github.com时,我的身份验证成功。

But when I make a git clone using the URL given by GitHub, I get the following error:但是,当我使用 GitHub 给出的 URL 进行 git 克隆时,出现以下错误:

git clone git@github.com:benblan/{private_repo}.git
Cloning into '{private_repo}'...
git@github.com: No such file or directory
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The ssh-agent is running. ssh 代理正在运行。

ps -eaf | grep ssh
benblan      1525    1455  0 09:58 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/im-launch cinnamon-session-cinnamon
benblan      2109    1452  0 09:59 ?        00:00:00 /usr/bin/ssh-agent -D -a /run/user/1000/keyring/.ssh

The only thing I see is that when I echo the variable SSH_AUTH_SOCK, I have a different path: /run/user/1000/keyring/ssh (no dot in front of ssh).我唯一看到的是,当我回显变量 SSH_AUTH_SOCK 时,我有一个不同的路径:/run/user/1000/keyring/ssh(ssh 前面没有点)。

I could use HTTPS with Personal Access Token, but I wanted to make the ssh connection work.我可以将 HTTPS 与个人访问令牌一起使用,但我想让 ssh 连接工作。

Any idea?任何想法?

Double-check your ssh client is fully installed/up-to-date:仔细检查您的 ssh 客户端是否已完全安装/最新:

sudo apt update
sudo apt install openssh-client

And specify the full path for ssh and your key:并指定 ssh 的完整路径和您的密钥:

export GIT_SSH_COMMAND="/usr/bin/ssh -i ~/.ssh/id_rsa"

Then try again.然后再试一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM