0

I've pushed from git to github on this ssh/set up before. IT HAS WORKED.

I created a new repo on github. I set up remote - when I type git remote -v it gives back two lines starting with "origin" that have the (fetch) and (push) addresses. They're both correct, correct username and spelling.

If I type

git add .
git commit -m "initial commit"
git push

I get "fatal: the current branch main has no upstream branch. To push..."

so I try the following command it suggests (I type it exactly, maybe I need to change a bit?)

git push --set-upstream origin main

Then it says: "ssh: Could not resolve hostname github: Name or service unknown /n fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repo exists"

So I check git remote -v

It has the correct name and the ssh definitely works - I used it yesterday. I've tried re-creating the repo and changing the remote already but that didn't help.

What is wrong? What can I try next? Thanks!

sw016428
  • 11
  • 1
  • 3
  • Are you able to view GitHub in your browser? Try `ping github.com` to verify if you have a route. Also `dig github.com` will test if you can lookup the domain name through DNS. – Code-Apprentice May 05 '23 at 15:17
  • I added a link at the top that has more suggestions to try. If none of those work for you, please [edit] your question to describe the result of each step that you tried. Ping me and we'll go from there. – Code-Apprentice May 05 '23 at 15:18
  • @Code-Apprentice I've tried this thread, everything except "- adding nameservers to /etc/resolv.conf fixed the issue for me!" No new errors, everything is authenticating re: ssh and Github's systems are up. – sw016428 May 05 '23 at 16:12
  • I've also tried uploading files to repo manually so there's something in it then adding a new file locally and pushing. It will stage, just won't add to repo. Exact same errors – sw016428 May 05 '23 at 16:15
  • Please [edit] your question to include the things you have tried and the results of each. – Code-Apprentice May 05 '23 at 23:58

0 Answers0