Git上传代码遇到的报错

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

 7、git clone 下载远程代码 403错误

#完整错误
Cloning into bare repository '.git'...
remote: User permission denied
fatal: unable to access 'https://git.test.com/001/test.git/': The requested URL returned error: 403

原因:存储在本地的用户名密码不正确或没有权限
解决:控制面板——用户账户——凭证管理器——Windows凭证——普通凭证——修改git:https:git.test.com的用户名密码,再重新clone就可以了

 

posted @ 2021-07-06 15:08  等风来~~  阅读(8108)  评论(0编辑  收藏  举报