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= [email protected]: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.
CodePudding user response:
gitconfig doesn't recognize single quotes. Use double quotes.
[core]
sshCommand = "ssh -i ~/.ssh/github_rsa -o IdentitiesOnly=yes"