Git error! [ rejected ] error : failed to push some refs to | us this Cm " git push -f origin main "

Опубликовано: 14 Май 2022
на канале: RajKishorBGP
85,600
1.1k

Why the error comes:    • Why the error comes || ! [rejected] e...  
If still you haven't resolved the error,
then use this command 👉 " git push -f origin main " 100% working
The " git push -f origin main " command is used to push into the repository .
------------------------------------------------------------------------------------------------------------------------
Today, I was trying to permanently delete a file in all commits using 👉 " git filter-branch ".
After, I needed to force a push obviously, in order to ensure that all collaborators have access to the repository without this file.

So, I tried 👉 git push -f origin "branch-name "
which gave me the usual "make sure you have the correct access rights" error.

There is no difference between [ git push -f main ] "branch" and [ git push --force main ] "branch".
-f is simply the shorthand for --force.
----------------------------------------------------------------------------------------------------------------------------
$ git push origin main
To https://github.com/rajkishorbgp/Lab-P...
#![rejected] #main-main(fetch first)
error: failed to push some refs to 'https://github.com/rajkishorbgp/Lab-P...
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

#rajkishorbgp
#git
#github
________________________________________________________________________________________________
Instagram:   / rajkishorbgp  
LinkedIn:   / rajkishorbgp  
GitHub: https://github.com/rajkishorbgp
Twitter:   / rajkishorbgp  
_________________________________________________________________________________________________