git push rejected

后端 未结 8 2028
無奈伤痛
無奈伤痛 2020-12-22 23:50

I give up! Whenever I try to push I get a stupid:

! [rejected]        master -> master (non-fast forward)
error: failed to push some refs to \'git@github         


        
8条回答
  •  有刺的猬
    2020-12-23 00:27

    If push request is shows Rejected, then try first pull from your github account and then try push.

    Ex:

    In my case it was giving an error-

     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'https://github.com/ashif8984/git-github.git'
    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.
    

    ****So what I did was-****

    $ git pull
    $ git push
    

    And the code was pushed successfully into my Github Account.

提交回复
热议问题