1.在https://github.com/注册或者登陆账号
2.在github上新建project
3.安装git客户端https://www.git-scm.com/
4.设置idea
5.在idea上设置git的全局变量:$git config --global user.name 'name'
$git config --global user.email 'email'
$git --list
$git config --list
6.上传idea的代码
在terminal终端上敲入代码
(1)git init
(2)git commit -m "注释"
(3)git remote add origin github地址
(4)git push -u origin master
7.错误:
Counting objects: 76, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (64/64), done.
Wfatal: The remote end hung up unexpectedly bytes/s
rror: RPC failed; result=56, HTTP code = 200ytes/s
Writing objects: 100% (76/76), 24.52 MiB | 0 bytes/s, done.
Total 76 (delta 8), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
Everything up-to-date
原因:
1、网络问题:提交代码到github上,毕竟是外网,所以有所怀疑。不过从GitHub clone 项目速度很快,所以这点排除了。
2、git缓存空间不够:这是网络上大量提供的思路
解决方案:
## 设置http缓存为1000M(大小可以根据需要自行更改) git config --global http.postBuffer 1048576000