2017-06-22 68 views
-1

我遇到問題。我使用git將代碼上傳到gitlab中,但是它拋出了下面給出的一些錯誤。使用git推送代碼時出現錯誤

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

在此之前,我已將代碼上傳到我的存儲庫。之後,我需要爲cms.securecodewarrior.com創建一些挑戰,因爲當我運行下面的命令時,它給了我上述錯誤。

1-git checkout -b secure 

2-git push --all 

請幫我解決這個錯誤。

+1

可能重複的[混帳錯誤:未能推一些裁判](https://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to) – YoannFleuryDev

+0

可能重複的[混帳拒絕推非快進](https://stackoverflow.com/questions/16899243/git-rejected-push-non-fast-forward) –

+0

我試過,但相同的錯誤信息來了。 – satya

回答

0

由於錯誤已經說明,有一些代碼不在您的本地副本中。 嘗試從遠程存儲庫中取出並將其與本地副本合併,然後再次推送。

+0

'git pull'是適當的命令。 – satya

+0

我確實喜歡這個第一次從遠程拉,然後推它,但仍然是相同的錯誤。 – satya

+1

如果你確定repo中沒有你需要的東西,那麼你可以嘗試'git push -f',它會強行推送它 –