So I keep getting this error when I try to push existing changes onto my github repo. This started after I created a README.md file after I noticed my repo did not have one on the github repo. Does this usually happen? If so whats the best way to fix this. I tried to delete the readme file but I definitely bugged something.
Asked
Active
Viewed 45 times
0
-
Would you be able to do a 'git pull' and then fix your code to resolve any potential merge conflicts and then push it? That usually resolves this issue. – Roe hit Feb 16 '22 at 22:09
-
I tried to pull it gives me a fatal error: couldnt find remote ref master – Samee_code Feb 16 '22 at 22:13
-
1You branch is called main, not master - so that’s expected – AD7six Feb 16 '22 at 22:39
-
https://stackoverflow.com/search?q=%5Bgit%5D+hint%3A+Updates+were+rejected+because+the+remote+contains+work+that+you+do – phd Feb 16 '22 at 23:38
1 Answers
0
First run: git pull origin main
Then run: git push origin main

RSD
- 87
- 9
-
-
-
Would my url be the one I use for the github Pages? Or would it just be my repo name? – Samee_code Feb 16 '22 at 22:18
-
-
It said remote origin already exists. And as I proceed to the next steps get the same errors. How does adding a README.md file after a project was commited cause such an error – Samee_code Feb 16 '22 at 22:23
-
1use `main` instead `master` and check again: `git pull origin main` and `git push origin main` – RSD Feb 16 '22 at 22:25
-
I think it is because of the different structure of the code that you are committing – RSD Feb 16 '22 at 22:29
-