目录
安装Git
官网地址: Git 下载对应系统的版本Git软件。
按照默认参数一步一步进行安装
配置ssh
安装完毕后,鼠标右键,打开 Git Bash窗口
ssh-keygen 生成ssh key,生成目录为 c/user/xx/.ssh/目录
将key添加 ssh-add -K ~/.ssh/id_rsa
报错: Could not open a connection to your authentication agent
解决办法:
先执行如下命令 ssh-agent bash
然后再执行 ssh-add ~/.ssh/id_rsa
下载代码
git clone xxx
两种不同的报错信息 :
no matching key exchange method found. Their offer: diffie-hellman-group14-sha1
no matching host key type found. Their offer: ssh-rsa
解决办法:
在~/.ssh/目录下(C:\Users\用户名\.ssh\)新建文件 config文件
写入如下内容:
Host *
KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
重新拉取代码即可。
提交代码报错
没有生成commit id。按照提示
remote: Processing changes: refs: 1, done
remote: ERROR: missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 lipan@review.rnd.meizu.com:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote: git commit --amend
按照提示进行操作时,报错
$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 lipan@review.rnd.meizu.com:hooks/commit-msg ${gitdir}/hooks/
subsystem request failed on channel 0
scp: Connection closed
解决办法:将提示方法中的scp -p改为scp -o
gitdir=$(git rev-parse --git-dir); scp -O -P 29418 lipan@review.rnd.meizu.com:hooks/commit-msg ${gitdir}/hooks/