Anybody seen this error and know what to do?
I\'m using the terminal, I\'m in the root, the GitHub repository exists and I don\'t know what to do now.
This happened to me. For some reason my origin got messed up without my realizing it:
Check if your settings are still correct
git remote -v
the url needs to be something like ssh://git@github.com/YourDirectory/YourProject.git; if you don't see git@github.com, use
git remote set-url origin git://github.com/YourDirectory/YourProject.git
to set it right. Or you could use the github app to check and set the Primary Remote Repository url in the settings panel of your particular repository.
tl;dr
in ~/.ssh/config
put
PubkeyAcceptedKeyTypes=+ssh-dss
Scenario
If you are using a version of openSSH > 7, like say on a touchbar MacBook Pro it is ssh -V
OpenSSH_7.4p1, LibreSSL 2.5.0
You also had an older Mac which originally had your key you put onto Github, it's possible that is using an id_dsa key. OpenSSH v7 doesn't put in by default the use of these DSA keys (which include this ssh-dss
) , but you can still add it back by putting the following code into your ~/.ssh/config
PubkeyAcceptedKeyTypes=+ssh-dss
Source that worked for me is this Gentoo newsletter
Now you can at least use GitHub and then fix your keys to RSA.
Also in ubuntu, even though there was already SSH key entered in settings in BitBucket, I got this problem. The reason was, I was trying the following:
sudo git push origin master
Not sure why, but it got solved by using
git push origin master
No sudo used.
I think i have the best answer for you, your git apps read your id_rsa.pub in root user directory
/home/root/.ssh/id_rsa.pub
That's why your key in /home/your_username/.ssh/id_rsa.pub can't be read by git. So you need to create the key in /home/root/.ssh/
$ sudo su
$ ssh-keygen
$ cd ~/.ssh
$ cat id_rsa.pub
Then copy the key in your github account. It's worked for me. You can try it.
I would like to add some of my findings:
If you are using GitBash
, then make sure the SSH key is stored in ~/.ssh/id_rsa
.
By Default GitBash
searches for ~/.ssh/id_rsa
as default path for SSH key.
Even the file name id_rsa
matters. If you save your SSH key in another filename or path, it will throw the Permission Denied(publickey)
error.
Maybe your ssh-agent is not enable You can try it
http://git-scm.com/
Install it
Enable ssh-agent
C:\Program Files\Git\cmd
start-ssh-agent