git error 解決方案

來源:互聯網
上載者:User

今天使用git clone項目的源碼時突然出現remote out of memery,解決辦法:

git config --global pack.windowMemory 2048m  ,我查了下記憶體,感覺是本地的git檔案太大了,都7,8g了 

我是直接在idea的terminal 直接打命令的,這個需要你配置好環境變數喔


最新同時遇到這個問題,因為需求的git源大於1g導致了這個問題

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

解決方案

git config --global http.postBuffer 2048m

通過下面命令查看是否生效

git config --list


但是事實證明超過1g上面的方法還是不行,下面是我在stackoverflow 找到的解決方案:

錯誤是這樣的:

Clone failedearly EOFThe remote end hung up unexpectedlyindex-pack failedRPC failed; curl 18 transfer closed with outstanding read data remaining


解決方案:

$ git clone http://github.com/large-repository(此處寫你自己的源) --depth 1$ cd large-repository$ git fetch --unshallow


depth用於指定複製深度,為1即表示只複製最近一次commit.

git shallow clone



git clone 預設會下載項目的完整曆史版本,如果你只關心最新版的代碼,而不關心之前的曆史資訊,可以使用 git 的淺複製功能:
$ git clone --depth=1 https://github.com/bcit-ci/CodeIgniter.git

--depth=1 表示只下載最近一次的版本,使用淺複製可以大大減少下載的資料量,例如, CodeIgniter 項目完整下載有近 100MiB ,而使用淺複製只有 5MiB 多,這樣即使在惡劣的網路環境下,也可以快速的獲得代碼。如果之後又想擷取完整曆史資訊,可以使用下面的命令:
$ git fetch --unshallow

或者,如果你只是想下載最新的代碼看看,你也可以直接從 GitHub 上下載打包好的 ZIP 檔案,這比淺複製更快,因為它只包含了最新的代碼檔案,而且是經過 ZIP 壓縮的。但是很顯然,淺複製要更靈活一點





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.