1git下载安装
- 官网下载地址https://git-scm.com/
linux输入:
# apt-get install git
2) 环境配置。
git config --global user.name "{用户名}"
git config --global user.emaile "{邮箱}"
git config --global merge.tool vimdiff
查看变量信息:
git config --list
生成sshkey(-C是大写):
ssh-keygen -t rsa -C "{邮箱}"
按照提示完成三次回车,即可生成 ssh key。
查看密钥内容:
cat ~/.ssh/id_rsa.pub
把密钥内容添加到服务器就可以,这一步操作去服务器查看。
2普通操作命令
1) 下载仓库
# 这个下载整个仓库
git clone {仓库地址}
# 下载某个分支的仓库
git clone -b {分支名} {仓库地址}
2) 上传仓库
git add *
git commit -m "{更新说明}"
git push origin {分支名字}
3)查看并切换分支
# 查看当前和全部分支
git branch -a
# 切换分支
git checkout {分支名}
4) 查看本地修改记录
# 查看修改的文件
git status
# 查看修改文件内的内容
git diff
这个文章呢,主要是记录下自己主要使用的命令,主要是当自己的笔记。