Solving: ! [rejected] master -> master (non-fast-forward)

 When I upload the program code to github I once had a problem like the following  



hint: Updates were rejected because the remote contains work that you do

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:username/namerepository.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Then I found the solution to the problem from https://gist.github(.)com/alexpchin/102854243cd066f8b88e following the command as follows :


Force it:
git push --set-upstream origin master --force






Continue to open a terminal and type the following command :



Force it:
git init

git add README.md

git add .

git commit -m "next commit"

git remote add origin git@github.com:username/repo.git


 git push origin master



Hope it can help you, thank you...

Berlangganan Untuk Menerima Update Terbaru:

0 Response to "Solving: ! [rejected] master -> master (non-fast-forward)"

Post a Comment