【问题标题】:Getting error while push the code using Git使用 Git 推送代码时出错
【发布时间】:2017-06-22 10:34:50
【问题描述】:

我正在使用 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

【问题讨论】:

标签: git gitlab


【解决方案1】:

正如错误所述,有些代码不在您的本地副本中。 尝试从远程仓库拉取并与本地副本合并,然后再次推送。

【讨论】:

  • 我确实喜欢这个,首先从远程拉,然后推送它,但仍然是同样的错误。
  • 如果你确定repo里面没有你需要的东西,那么你可以试试git push -f,它会强制推送
猜你喜欢
  • 1970-01-01
  • 2019-11-30
  • 1970-01-01
  • 2020-11-15
  • 2014-08-10
  • 1970-01-01
  • 2023-03-16
  • 2012-11-05
  • 1970-01-01
相关资源
最近更新 更多