! [rejected] master -> master (fetch first)

后端 未结 24 2991
说谎
说谎 2020-12-02 04:15

Is there a good way to explain how to resolve \"! [rejected] master -> master (fetch first)\'\" in Git?

When I use this command $ git push or

24条回答
  •  情话喂你
    2020-12-02 04:26

    Problem Solved

    Problem I had

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

    I also had the same problem. The problem is that your commits in other repositories were not successfully pushed so you need to run the following commands:

    1. git fetch origin master

      output: From https://github.com/username/repo-name * branch master -> FETCH_HEAD

    2. git merge origin master

      output: Merge made by the 'recursive' strategy. repo-name/ReadMe.md | 1 - 1 file changed, 1 deletion(-)

    3. git push

      output: Enumerating objects: 8, done. Counting objects: 100% (8/8), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 1.00 KiB | 1.00 MiB/s, done. Total 6 (delta 2), reused 0 (delta 0) remote: Resolving deltas: 100% (2/2), completed with 1 local object. To https://github.com/user_name/repo-name.git 0852d5vf..70v56d9 master -> master

    Thank You so much

提交回复
热议问题