简体   繁体   中英

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. 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:

[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:

'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. Changing permissions on the key from 600 to 400 also had no effect. The file definitely exists, and exists at exactly that path.

gitconfig doesn't recognize single quotes. Use double quotes.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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