1、关联本地仓库后,往远程提交代码。
$ git push -u origin master
结果出现以下提示:
“
failed to push some refs to ...
”
这是由于创建远程仓库的时候生成了一个 README.md
而本地目录中并没有该文件。因此需要先进行合并代码,在执行git push命令
git pull --rebase origin master
这时你会发现本地仓库已经出现了该文件,那么就可以正常上传了。
2、接着第一步的步骤,这个时候如果上传的时候发现
Counting objects: 2649, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1280/1280), done.
error: RPC failed; result=22, HTTP code = 413 | 116 KiB/s
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2504/2504), 449.61 MiB | 4.19 MiB/s, done.
Total 2504 (delta 1309), reused 2242 (delta 1216)
fatal: The remote end hung up unexpectedly
那么是因为网速过慢导致的,有以下几个方法解决:
- 过一会重新提交
- 在命令行中运行 git config --global http.postBuffer 524288000
- 在 .git文件中找到config文件,在后面加上 [http] postBuffer = 524288000