繁体   English   中英

SSH git 推送时出现“没有这样的文件或目录”错误

[英]SSH "no such file or directory" error on git push

我有一个位于~/.ssh/github_rsa的私钥,相应的公钥已上传到我的 Github 帐户。 我创建了一个存储库并将其设置为我正在使用的目录的远程,在该目录的.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/*

当我运行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.

删除-o IdentitiesOnly=yes没有任何效果。 将密钥的权限从 600 更改为 400 也没有效果。 该文件肯定存在,并且存在于该路径中。

gitconfig 不识别单引号。 使用双引号。

[core]
    sshCommand = "ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes"

暂无
暂无

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

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