Git上传GitHub常用命令


git config --global user.name 'lanyu96'
git config --global user.email '[email protected]'
//设置SSH key
cd ~/.ssh  //检查是否已生成密钥
ssh-keygen -t rsa -C "[email protected]" //生成key
C:\User\zhou\.ssh(zhou为电脑用户名) id_rsa.pub
将ssh key加入到github里

git status
git add hello.py
git add . //添加所有文件
git commit -m '提交描述'

git remote add origin 仓库地址 //添加仓库地址

git pull --rebase origin master //代码合并

git push -u origin master  //上传本地代码
//删除云端文件,本地保留
git rm --cached -r filename 
git commit -m "注释" 
git push -u origin master 


touch test.php //创建文件
rm test.php //删除文件
git rm test.php //从Git中删除
git config --list //查看配置清单

git clone http.... //从Github中将数据下载到本机

git branch test //创建分支

git checkout test //切换分支

git remote add origin https://***********    //与远程分支关联

git push origin test  //将分支上传
 

猜你喜欢

转载自blog.csdn.net/wx_lanyu/article/details/84585121
今日推荐