GIt使用记录1:使用Git上传项目到Github
1、安装git
具体操作省略
2、配置GitHub仓库
1、创建仓库

2、复制仓库地址

3、配置GitHub服务器的密钥
因为Git使用SSH连接,而SSH第一次连接需要验证GitHub服务器的Key。确认GitHub的Key的指纹信息是否真的来自GitHub的服务器。解决办法。其实就是在本地生成key配置到github服务器。
1)、在前面安装好的git bash中使用命令: ls -al ~/.ssh

2)、使用命令: ssh-keygen -t rsa -C "github用户名",按三次回车

3)、查看生成的key:cat ~/.ssh/id_rsa.pub

4)、登陆github,复制新生成的SSH配置到服务器,


4、上传本地项目
1):打开git bash ,cd进入你放项目文件的地址,我的地址在D:\xxx\xx\项目

2):输入git init 这个意思是在当前项目的目录中生成本地的git管理(会发现在当前目录下多了一个.git文件夹)

3)输入git add .

4)输入git commit -m "测试",表示你对这次提交的注释,双引号里面的内容可以根据个人的需要

5)这里如果出现以下内容,则需要你输入自己的账号或名字

6)用上面提示的代码输入自己的邮箱或名字


7)再输入git commit -m "测试"时就会成功

8)上传到github远程仓库
git remote add origin (你之前在github上复制的链接)git@github.com:test.git
git push -u origin master

注意如果此处上传失败
出现错误的主要原因是github中的README.md文件不在本地代码目录中

可以通过如下命令进行代码合并【注:pull=fetch+merge]
git pull --rebase origin master

执行上面代码后可以看到本地代码库中多了README.md文件


此时再执行语句 git push -u origin master即可完成代码上传到github


注意
1、Git提交代码发生LF will be replaced by CRLF in 问题
原因是需要提交的文件是在windows下生成的,windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行add . 时出现提示,解决办法:git config --global core.autocrlf false再执行git 提交
2、fatal: sha1 file '<stdout>' write error: Broken pipe
git push会出现一个问题:就是关于文件的大小!因为github的默认大小是100M,如果你的文件大于100M,那么你就不能成功,会出现这个:fatal: fatal: sha1 file '<stdout>' write error: Broken pipe The remote end hung up unexpectedly error
解决办法为:git config http.postBuffer 52428800 把大小配的大些即可