Cannot push to github, ssh: Could not resolve hostname
34,152
Solution 1
Instead of adding a new remote, try to change the existing one with the following command:
git remote set-url origin [email protected]:<username>/demo_app.git
Edit: so, here are the commands to make it work without losing your code.
rm -rf .git
git init .
git remote add origin [email protected]:<username>/demo_app.git
git commit --allow-empty -m 'First commit'
git push origin master
Solution 2
If you got here because you're on a proxy
Try:
ssh -T -p 443 [email protected]
If that works then you can add settings to your ~/.ssh/config
to always connect through 443
:
Host github.com
Hostname ssh.github.com
Port 443
More info here: https://help.github.com/articles/using-ssh-over-the-https-port/
Author by
A Ali
Updated on June 25, 2020Comments
-
A Ali almost 4 years
I can't get pass this, have remade the repository multiple times, made ssh keys over
-------------- demo_app <username>$ git remote add origin [email protected]:<username>/demo_app.git fatal: remote origin already exists. $ git push -u origin master --- ssh: Could not resolve hostname git: nodename nor servname provided, or not known --- fatal: Could not read from remote repository. --- Please make sure you have the correct access rights --- and the repository exists. ---------- --------- Checked ssh keys --- $ ssh -T [email protected] Hi <username>! You've successfully authenticated, but GitHub does not provide shell access. ---
Still receiving the same message.
-
A Ali almost 11 yearstried that before, turns out i didn't do $ git add . before, I tried to create what i did before to get the error message but I got a diff error "error: src refspec master does not match any. error: failed to push some refs to '[email protected]:<username>/demo_app0.git'