Git上傳代碼遇到的報錯
1、git上傳代碼卡住(Total 7072 (delta 2508), reused 6844 (delta 2376), pack-reused 0)
git config --global sendpack.sideband false
git config --local sendpack.sideband false git config --global http.postBuffer 524288000 git config --global https.postbuffer 524288000 git config --global -l git config --local -l
執行完這些命令后,再上傳git push -u origin master,可能會稍微卡一會兒,然后就成功了。
2、修改保存在本地的git用戶名密碼
git config --global user.name "用戶名"
git config --global user.password "密碼"
git config --global -l #查看
3、上傳代碼報錯:error: failed to push some refs to 'http://git.test.com/001/test.git'
#完整報錯:
error: failed to push some refs to 'http://git.test.com/001/test.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
原因分析:這個問題是因為遠程庫master分支代碼與本地庫master分支代碼不一致造成的
解決方法:可以把遠程庫同步到本地庫,再把本地庫推送到遠程庫
git pull --rebase origin master
git push -u origin master
4、上傳代碼報錯:error: RPC failed; result=22, HTTP code = 413
#完整錯誤:
error: RPC failed; result=22, HTTP code = 413 fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date
原因分析:上傳文件太大,超過了最大限制
解決方法:nginx傳輸限制:(nginx.conf)
client_max_body_size 400M;
git傳輸限制:
git config --global http.postBuffer 524288000
git config --global https.postBuffer 524288000
5、 error: RPC failed; HTTP 403 curl 18 transfer closed with 22 bytes remaining to read
#完整錯誤:
error: RPC failed; HTTP 403 curl 18 transfer closed with 22 bytes remaining to read send-pack: unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly Everything up-to-date
原因分析:是因為保存在本地的賬戶密碼不正確,導致上傳錯誤
解決方法:編輯.git/config文件,在url后面添加賬戶名+@,保存退出后再執行push操作,就會彈出讓你輸入gogs賬戶的密碼,成功上傳,問題解決。
[remote "origin"] url = http://gogs@git.test.com/001/test.git fetch = +refs/heads/*:refs/remotes/origin/*
6、git clone下載代碼錯誤
#完整錯誤 fatal: unable to access 'https://git.test.cmo/001/test.git/': SSL certificate problem: certificate has expired 原因:證書過期,SSL驗證卡住了 解決方法:關閉SSL驗證 git config --global http.sslVerify false