I am having trouble pushing a new local repository to Github over SSH.
What I do is:
- Initialize a new local repository and create an initial commit
- Use
git push --set-upstream [email protected]:USERNAME/test.git main
At this point, I expect to have a new remote repository created on Github, and have origin for the local repository point to the remote URL for fetch and push.
What I get is an error message:
ERROR: repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
Also, remote -v
returns nothing. No remote or origin were set.
To troubleshoot, I have tried this.
Validate SSH authentication with ssh -T [email protected]
. This returns “Hi USERNAME! You’ve successfully authenticated,…”
I have also created a new repository on Github through the web UI, then used SSH to clone the repository locally. I edited, created a new commit and was able to successfully push changes back to Github via SSH.
So SSH authentication appears to work, along with git clone and git push.
Using git remote add origin [email protected]:USERNAME/test.git
does add the origin URLs for fetch and push, but then `git push –set-upstream origin main’ fails with the same “repository not found” error as above.
It seems the issue is that I cannot set an upstream branch, and/or Github does not let me create a new repository over SSH. Any pointers how to resolve this would be much appreciated.
Rene Beekman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.