Git Guide
常用以及重要的github命令总结:
- 基本配置
- 配置用户配置
$ git config --global user.name "hello myself"
$ git config --global user.email example@xx.com
- 差异分析工具
$ git config --global merge.tool vimdiff
- 查看配置信息
$ git config –list
</br>
- 配置用户配置
-
配置ssh链接
- 生成密钥
ssh-keygen -t rsa -C example@xx.com
- 存储路径
cd ~/.ssh
- 添加密钥
eval "$(ssh-agent -s)"
- 添加生成的 SSH key 到 ssh-agent
ssh-add ~/.ssh/id_rsa
- 登陆github设置中添加密钥, 复制id_rsa.pub的内容就可以了
测试:
ssh -T git@github.com
- 生成密钥
-
Git仓库获取
$ git clone https://github.com/YvanPang/MoPCHong.github.io
- 获取远端最新版本
$ git pull
$ git remote -v
$ git fetch origin master
-
更新本地版本 >
$ git add xxx.file
$ git add –A
#全部提交
$ git commot –m “info”
$ git push
</br> - Clone Repositories
Demo:
$ git clone https://github.com/usernameusername.github.io
$ git add --all
$ git commit -m "Initial commit"
$ git push -u origin master