git命令--上传到gitee
全局配置
-
全局配置(用Git Bash)
git config --global user.name "账号"
git config --global user.email "邮箱" -
查看配置
git config -l
SSH密钥
-
新建密钥(用Git Bash)
ssh-keygen -t rsa -C "邮箱名"
按三次回车 -
查看密钥
ls ~/.ssh/
id_rsa id_rsa.pub //输出 -
查看密钥详情
cat ~/.ssh/id_rsa.pub -
复制id_rsa.pub,粘贴到gitee的SSH 公钥中
连接
-
初始化
git init -
与远程仓库连接
git remote add origin https://gitee.com/xxx.git -
代码合并(因为gitee中的README.md文件不在本地代码目录中)
git pull --rebase origin master -
所有文件添加到缓存
git add . -
将缓存区内容添加到仓库
git commit -m "这是注释"若想跳过add,就执行
git commit -am "这是注释" -
取消已缓存的内容
git reset HEAD a.txt -
pull服务器的代码到本地
git pull origin master -
push代码到服务器
git push origin master
其他命令
-
回退代码
git reset --hard 版本号 -
强制推送到远程仓库
git push -f origin develop -
查看分支
git branch -
切换分支
git checkout xxx -
克隆项目库
git clone 项目ssh地址 -
查看git的提交历史
git reflog
本文来自博客园,作者:格林格林,转载请注明原文链接:https://www.cnblogs.com/beiyi-Lin/p/17876657.html

浙公网安备 33010602011771号