一、設置user.name 和 user.email
1.查看user.name和user.email
git config --list //查看配置
git config user.name
git config user.email
2.配置user.name 和 user.email(global為全局配置)
git config --global user.name "myname"
git config --global user.email "myemail@163.com"
二、設置SSH Key
1.查看本地是否已經有ssh文件(pub文件)
我的文檔 ---> .ssh目錄下。id_rsa、id_rsa.pub文件
2.生成ssh key
ssh-keygen -t rsa -C "myemail@163.com"
1. 查看當前remote
git remote -v
2. 切換到https:
git remote set-url https://github.com/yourusername/repository.git
3. 切換到ssh:
git remote set-url git@github.com:yourusername/repository.git
四、https協議,密碼緩存。(我的文檔下.gitconfig文件)公司vpn連接時,只能用https協議。
git config --global credential.helper store
五、git設置短命令
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.ps push
git config --global alias.pl pull