. Advertisement .
..3..
. Advertisement .
..4..
For the problem “! [rejected] master -> master (fetch first).” I tried to fix it, but It doesn’t work and returns the result I want. Here is my program:
$ git push origin master
and
! [rejected] master -> master (fetch first)
error: failed to push some refs to '[email protected]:zapnaa/abcappp.git'
has occurred. I’ve checked the entire command line but still can’t find the mistake.
The cause: Someone else has most likely already pushed to master, and your commit is behind. As a result, you’ll need to fetch, merge the changeset, and then push again.
If you don’t (or, even worse, if you force it with the —force option), the commit history will be messed up.
The solution: To solve this problem, you have to “fetch first.” Use the following command:
git fetch origin master
Then, to combine, follow these steps:
git pull origin master
git add .
git commit -m 'your commit message'
git push origin master
try:
After I wrote the code, I got another error: “non-fast forward”
This is the code I wrote:
I was able to resolve my problem