代码上传到GitHub
1.创建项目
1.点击+号->new repository 填写Repository的名字 填写Repository的描述 (Initialize this repository with a README)可选
2.创建完成后点击clone or download 复制Repository的地址
2.本地初始化一个项目
1.git 的基础配置,作用是告诉 git 你是谁
git config --global user.name "lynn"
git config --global user.email "878951561@qq.com"
2.在你的需要初始化版本库的文件夹中执行
git init
git remote add origin https://github.com/LynnRachel/requestsforpermissions.git
3.如果你想克隆一个项目,只需要执行(不是必须)
git clone https://github.com/LynnRachel/requestsforpermissions.git
3.完成第一次提交
1.进入你已经初始化好的或者克隆项目的目录,然后执行
git pull origin master
git add .
2.若出现该warning: LF will be replaced by CRLF in xxx文件(解决办法如下代码)
git config --global core.autocrlf false //禁用自动转换
3.提交信息
git commit -m "init code第一次提交"
4.正式上传
git push origin master
更新代码到GitHub
1.正规方式
添加
git add <filename>
提交
git commit -m "代码提交信息"
推送
git push origin master
2.强制推送(路子比较野谨慎使用)
将本地更新的代码push到远程(如果普通的git push origin master提交不上,又不是协同开发,可以使用这个)
git push -u origin master -f
若还是有疑问 楼主QQ:878951561(请备注CSDN)