(一).秘钥设置
1.打开Git Bash查看电脑上是否已经存在SSH密钥:
输入 cd ~/.ssh
2.创建新的ssh key:
ssh-keygen -t rsa -C "xxxx@lsc.com"
可以直接按Enter
然后提示输入 passphrase(密码),输入两次(可以不输直接两次Enter),
然后会在 .ssh 目录生产两个文件:id_rsa和id_rsa.pub
用记事本打开.ssh目录下的id_rsa.pub文件,复制里面的内容;
3、复制ssh key到github:在你的账户页面setting里面
On the GitHub site Click "Settings" > Click "SSH Keys" > 粘贴到Key框里面,然后add下
(二).每个项目都有clone按钮选型,点击就会有ssh连接地址
git clone ssh://xxxxx
(三).更新操作
进入到指定的下载目录(git工具里面会显示master表示的)
git pull origin master
(四).git命令
git log -n 3 日志查看,数字表示条数
git remote -v 显示远程连接
git --help 显示帮助信息
(五).常见错误
在执行git pull origin master时出现:
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists
解决方案:
git remote add origin git@github:bx_reader/bx-reader-api.git