Git 倉庫 Push到Git@OSC常見錯誤

來源:互聯網
上載者:User

標籤:

將在本地建立的Git倉庫push到[email protected]出現的錯誤

常見錯誤:

1.error:failed to push some refs to ...

    問題(Non-fast-forward)的出現原因在於:git倉庫中已經有一部分代碼,所以它不允許你直接把你的代碼覆蓋上去。於是你有2個選擇方式:  

1.強推,即利用強覆蓋方式用你本地的代碼替代git倉庫內的內容git push -f
2. 先把git的東西fetch到你本地然後merge後再push$ git fetch$ git merge這2句命令等價於$ git pull

可是,這時候又出現了如下的問題:

上面出現的 [branch "master"]是需要明確(.git/config)如下的內容

[branch "master"]

    remote = origin

    merge = refs/heads/master

這等於告訴git2件事:

1,當你處於master branch, 預設的remote就是origin。

2,當你在master branch上使用git pull時,沒有指定remote和branch,那麼git就會採用預設的remote(也就是origin)來merge在master branch上所有的改變

如果不想或者不會編輯config檔案的話,可以在bush上輸入如下命令列:

$ git config branch.master.remote origin $ git config branch.master.merge refs/heads/master

之後再重新git pull下。最後git push你的代碼吧。

2.錯誤資訊:error: object file .git/objects/c6/884991eaac39417e314faa6685061eab18909d is empty

fatal: loose object c6884991eaac39417e314faa6685061eab18909d (stored in .git/objects/c6/884991eaac39417e314faa6685061eab18909d) is corrupt

解決方案:

1  rm .git/objects/c6/884991eaac39417e314faa6685061eab18909d 2 .git fsck --full  3.git reflog


Git 倉庫 Push到[email protected]常見錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.