简体   繁体   中英

Rejected error on push repository in Gitlab

I want to push some test file to the myfirstgittrial project on GitLab.

When i run this git push origin master command on ubuntu terminal I got this error

To git@gitlab.com:RamS20_2/myfirstgittrial.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitlab.com:RamS20_2/myfirstgittrial.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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.

And my Origin value is

origin  git@gitlab.com:RamS20_2/myfirstgittrial.git (fetch)
origin  git@gitlab.com:RamS20_2/myfirstgittrial.git (push)

The Error clearly says your branch is behind, So first do

1. git pull

  1. git add.
  2. git commit -m "message"
  3. git push origin master or git push

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM