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!

5
  • 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. Commented May 5, 2023 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. Commented May 5, 2023 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. Commented May 5, 2023 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 Commented May 5, 2023 at 16:15
  • Please edit your question to include the things you have tried and the results of each. Commented May 5, 2023 at 23:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.