[英]SSH "no such file or directory" error on git push
I have a private key that lives at ~/.ssh/github_rsa
, and the corresponding public key has been uploaded to my Github account.我有一个位于
~/.ssh/github_rsa
的私钥,相应的公钥已上传到我的 Github 帐户。 I created a repository and set it up as the remote for the directory I'm working from, and in that directory's .git
folder, I have the following config
file:我创建了一个存储库并将其设置为我正在使用的目录的远程,在该目录的
.git
文件夹中,我有以下config
文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sshCommand = 'ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes'
[remote "repoName"]
url= git@github.com:myusername/repoName.git
fetch = +refs/heads/*:refs/remotes/repoName/*
When I run git push -u repoName main
, I get the following error:当我运行
git push -u repoName main
时,出现以下错误:
'ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes': line 1: ssh -i github_rsa -o IdentitiesOnly=yes: No such file or directory
fatal: Could not read from remote repository.
Removing -o IdentitiesOnly=yes
has no effect.删除
-o IdentitiesOnly=yes
没有任何效果。 Changing permissions on the key from 600 to 400 also had no effect.将密钥的权限从 600 更改为 400 也没有效果。 The file definitely exists, and exists at exactly that path.
该文件肯定存在,并且存在于该路径中。
gitconfig doesn't recognize single quotes. gitconfig 不识别单引号。 Use double quotes.
使用双引号。
[core]
sshCommand = "ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.