使用Git推送代码时出错

时间:2017-06-22 10:34:51

标签: git gitlab

我正在使用Git将代码上传到Gitlab,但是它会抛出一些错误,如下所示。

subrajyoti@subrajyoti-H81M-S:/opt/lampp/htdocs/MeetingRoomBooking/mrb_correct$ git push --all
Password for 'https://Subhraj@git-cms.securecodewarrior.com': 
To https://Subhraj@git-cms.securecodewarrior.com/Subhraj/Meeting-room-booking.git
 ! [rejected]        secure -> secure (fetch first)
error: failed to push some refs to 'https://Subhraj@git-cms.securecodewarrior.com/Subhraj/Meeting-room-booking.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.
subrajyoti@subrajyoti-H81M-S:/opt/lampp/htdocs/MeetingRoomBooking/mrb_correct$

在此之前,我已将代码上传到我的存储库中。之后我需要在cms.securecodewarrior.com中创建一些挑战,因为当我运行下面的命令时,它给了我上面的错误。

1-git checkout -b secure

2-git push --all

1 个答案:

答案 0 :(得分:0)

由于声明了错误,因此有些代码不在本地副本中。 尝试从远程存储库中提取并将其与本地副本合并,然后再次按下。