1. 程式人生 > >解決Git出現的常見錯誤

解決Git出現的常見錯誤

錯誤1:

The file will have its original line endings in your working directory.

解決:

git rm -r --cached ./

git config core.autocrlf false

git add ./

錯誤2:

Git master branch has no upstream branch

$> git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

原因分析:沒有將本地的分支與遠端倉庫的分支進行關聯。出現這種情況主要是由於遠端倉庫太多,且分支較多。在預設情況下,git push時一般會上傳到origin下的master分支上,然而當repository和branch過多,而又沒有設定關聯時,git就會產生疑問,因為它無法判斷你的push目標。 

解決:

方法一:(遠端分支存在的情況才能使用)

# 檢視要指向的 repository
git remote -v

# 檢視所有分支
git branch -a


git push --set-upstream origin master

# master: 遠端branch
# oringin: 在clone遠端程式碼時,git為你建立的指向這個遠端程式碼庫的標籤,它指向repository。

方法二:根據需要,替換origin和master,此方法的好處是即使遠端沒有你要關聯的分支,它也會自動建立一個出來,以實現關聯。

git push -u origin master

錯誤3:

! [rejected]        master -> master (fetch first)

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]:bboyHan/golang-data.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.

原因分析:沒有同步遠端的master

解決:

  git pull origin master

相關推薦

解決Git出現常見錯誤

錯誤1: The file will have its original line endings in your working directory. 解決: git rm -r --cached ./ git config core.autocrlf false

Git常見錯誤提示解決辦法和常用方法

log image 解決 遠程 添加 logs 遠程倉庫 錯誤 ima 1.添加遠程倉庫時提示fatal: remote origin already exists. 先刪除遠程倉庫,再添加遠程倉庫 最後再push 2.修改本地文件(比如README.md)後,更新到g

Git 出現502錯誤 完美解決辦法

第一步:找到專案所在根目錄位置 第二步:Bash Here 第三步:粘上這個  回車  然後就可以開心的Pull啦~~~ 下面這個↓ for((i=10;i<=200;i=i+10));do

Git使用常見錯誤,建立倉庫-提交程式碼攻略 Github錯誤:fatal: Authentication failed for 'https://github.com/ ...

專案開發進入測試階段,公司非IT公司,臨時搭建起來的開發團隊,沒有運維,服務端那邊也沒有提供SVN 或者git地址。所以一個月的時間都是把程式碼放到本地。幸好是公司桌上型電腦,並沒有出現硬碟損壞,程式碼丟失等天災人禍,不過已經進入發版階段,肯定設計開設分支等問題,所以還是抽出一點時間,把程式碼上傳至

Java 語言最容易出現常見錯誤

好記憶不如爛筆頭,能夠記錄點什麼,就趕緊記錄點 , 方便知識的積累 !  1. 使用"=="判斷兩個字串相等;     在判斷兩個字串的時候,不要使用"=="判斷兩個字串相等. 2. 在foreach中改變list的結構; &nbs

centos7中Python切換到Python3.x版本(解決出現錯誤

在伺服器中安裝Python3.x時,我使用的是centos7,伺服器中預設安裝的是Python2.7,l 安裝python3.5可能使用的依賴yum install openssl-devel bzip

git使用常見錯誤及修復

1 2 3 4 $ git pull -f Updating 0260748..56d98c2 error: Your local changes to the following files would be overwritten b

Git 項目上傳至github入門實戰並解決常見錯誤

fat 問題 進行 需要 ext 例子 word 防止 要求 1.Git GUI 首先,在push到github的項目必須先建立版本(即creat repository的名字一樣),一般是先pull下來,再push(為了防止有其他人提交了代碼,而你卻不知道,造成的一些沖突

IDEA使用Git出現push to origin/master was rejected錯誤解決方案

reject url all 圖片 ima 解決方案 技術 cte min 在IDEA中配置碼雲的URL,如下圖 切換到自己項目所在的目錄,右鍵選擇GIT BASH Here 在terminl窗口中依次輸入命令: git pull git pull ori

Git常見錯誤與操作:error: src refspec master does not match any解決辦法

Git常見錯誤與操作:error: src refspec master does not match any解決辦法 一、 出現錯誤 error:src refspec master does not match any 原因分析: 引起該錯誤的原因是目錄中沒有檔案,空目

[Ting's筆記Day3]解決Git常見錯誤non-fast-forward問題

寫文章最難的部分,是找題材!   所以最近每次遇到bug或錯誤都挺興奮開心(zflwx)的,因為又可以寫筆記了 也可以記錄新手學習之路上遇到的常見問題,提供其他新手參考。   最近學Udemy平臺Ruby學習線上課程,我在本機練習做了一個Ruby on Rails專案(名稱定為:

部署 Bonobo Git Server 時,出現 HTTP 錯誤 500.19 解決辦法

解決辦法: 控制面板 -> 程式和功能 -> 啟用或關閉 Windows 功能 -> Internet Infomation Services -> 全球資訊網服務  -> 應用程式開發功能 -> 勾選 ASP.NET 4.X 並確定 參考連結: http://sta

Git遠端推送常見錯誤解決方案:

Git遠端推送 1、問題:git遠端提交時出現錯誤: error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errfno 10054 原因分析:可能是檔案過大導致。 解決方法:

Git使用中出現錯誤以及解決辦法積累

1.問題情境:昨晚上在上傳程式碼的時候,commit程式碼以後沒有進行push就放在那裡,今天修改了新的模組以後,上傳程式碼時出現瞭如下錯誤: commit is not possible because you have unmerged files h

Git常見錯誤解決方法

1.fatal: Couldn't find remote ref master或者fatal: 'origin' does not appear to be a git repository以及fatal:Could not read from remote repos

git安裝詳細過程及常見錯誤解決過程

目的:通過Git管理github託管專案程式碼一、下載安裝Git1、下載Git  官方地址為:https://git-scm.com/download/win。根據自己的需要選擇對應的版本2、下載好之後點選安裝,可自定義安裝路徑,2.17版本可按照預設選項進行安裝,這裡講一講遇到的問題:安裝完成後可在開始選單

androidstudio git專案到github出現錯誤解決辦法

error1: Push rejected: Push to origin/master was rejected 意思是push被拒絕 這是因為你在github上建立的那個repository裡面的

Ubuntu 搭建svn服務器 ,以及常見錯誤解決方案

mkdir creat mod 服務 csdn 解決 details 守護 center 一、安裝命令: 1)以root身份登錄。執行:sudo su -命令 2)執行安裝命令:apt-get install subversion 二、創建項目目錄 1)mkdir /

解決Maven出現Plugin execution not covered by lifecycle configuration 錯誤

style mic fff title over overflow font span config http://blog.163.com/xh_ding/blog/static/1939032892015222368827/ 解決Maven出現Plugin execut

在myeclipse中使用maven前常見錯誤解決辦法

eclips aam lai loj yate ren err jar ued %E4%BD%BF%E7%94%A8CHttpFile%E4%BB%8E%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF%E6%AD%A3%E7%A1%AE%E7%9A%