New User: Unable to Push File #22772
-
Hello Gitworld, I’m a new user to both Ubuntu Linux (WSL) and Github, so bear with me. So far I’ve setup my account, added my SSH key and I’ve authenitcated in my WSL terminal. I wanted to try out pushing and pulling, so I created a new directory and created a new Git instance locally, then created a basic readme.txt within said directory. I created a repository on GitHub with the same name as the local directory (instance). Now the issue… I connected my local repository to the remote one:
but when I push:
I recieve this error message:
I’m not sure what the error is, since I’m not using a ‘remote-http’ command at all in the line? Any guidance would be much appreciated, thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments
-
Sounds like you made a mistake when you did your Try |
Beta Was this translation helpful? Give feedback.
-
when I try git remove -v it gives:
|
Beta Was this translation helpful? Give feedback.
-
“remote” with a T 😉 |
Beta Was this translation helpful? Give feedback.
-
oh jeez… thank you. |
Beta Was this translation helpful? Give feedback.
-
I removed my username between the URL and .git file, but both were identical. Is that to be expected? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Yes, but not if you plan to use SSH. You should |
Beta Was this translation helpful? Give feedback.
-
There’s no need to remove the remote though, you can just change the URL. 😉 |
Beta Was this translation helpful? Give feedback.
-
You mean if you just do an add with a colliding name it’ll replace the URL? I’ve never tried. |
Beta Was this translation helpful? Give feedback.
-
No, you can change the URL of the existing remote:
There are also options to change e.g. just the push URL, but I don’t see a need for that here. |
Beta Was this translation helpful? Give feedback.
-
Oh okay, I see what you’re getting at. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thank you @kingthorin & @airtower-luna! Appreciate all the replies and help. I had a feeling I had to use the SSH URL, but wasn’t sure. I found a solution in the end by switching to it, but everytime I used: git push origin master I would get the error: error: src refspec master does not match any When I used: git push origin It worked! |
Beta Was this translation helpful? Give feedback.
-
The difference is with |
Beta Was this translation helpful? Give feedback.
Thank you @kingthorin & @airtower-luna! Appreciate all the replies and help. I had a feeling I had to use the SSH URL, but wasn’t sure. I found a solution in the end by switching to it, but everytime I used:
git push origin master
I would get the error:
error: src refspec master does not match any
error: failed to push some refs to ‘github.com:CodezHere/heelo-world.git’
When I used:
git push origin
It worked!
What is the difference between the two? Am I losing anything by not being able to run the “git push origin master” command?