本地Git的基本配置和与GitHub之间免密pull、push的方法
1.设置本地用户名和邮箱
git config --global user.name "your username(maybe not your git username)"
git config --global user.email "your email(maybe not your git email)"
2.设置公私密钥对
cd $HOME/.ssh
rm -f rsa*
ssh-keygen -t rsa -C "your email(step1)"
在生产公私钥对时一直按回车即可,将生成的rsa_pub公钥的内容复制一份到GitHub的SSH and GPG keys中
3.从远端clone项目代码到本地
git clone -b originbranch (master) httpaddres of your git-project(begin of https)
4.设置远端访问方式为ssh
git remote set-url origin sshaddres of your git-project(begin of git)
5.本地关联远程分支
git branch --set-upstream-to=origin/originbranch(master)
6.可设置git常用命令的别名:
alias gs='git status'
alias ga='git add'
alias gm='git commit -m'
alias gam='git commit -am'
alias gpul='git pull'
alias gpsh='git push'