-2

after coding up a javascript project, I wrote

git push -u origin main

however it gives me back:

ssh: connect to host github.com port 22: Undefined error: 0
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

pic to describe it

What should I do? Im new to git/github in general and have been trying to solve it with out luck. Thank you to all the answers in advance

Jake Worth
  • 5,490
  • 1
  • 25
  • 35
  • 1
    These are the instructions for SSH. Have you uploaded an SSH key to GitHub? https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh – Jake Worth Jun 09 '21 at 20:40
  • yes thank you it worked! – Yefim Blokh Jun 09 '21 at 20:44
  • Have you add the *remote-url* from the git repository? Before `git push`, add the url with `git remote add origin https://github.com/user-name/repo-name.git`. – SwissCodeMen Jun 09 '21 at 20:46
  • Side note: that error message, `Undefined error: 0` is terrible. Apparently the Mac version of ssh needs a bit of work. (Which macOS are you running?) – torek Jun 10 '21 at 01:59

1 Answers1

0

When connecting to GitHub via SSH, ensure that you have uploaded an SSH key to GitHub. This article explains the process.

https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

Jake Worth
  • 5,490
  • 1
  • 25
  • 35