git与ssh配置方法及注意事项
配置ssh key
- 生成
ed25519 密钥 ssh-keygen -t ed25519 -C YOUR_EMAIL
use your real email value instead of YOUR_EMAIL
将私钥添加到身份验证代理 ssh-add
- 将
~/.ssh/id_ed25519.pub 的文本添加到gerrit 或git 用户配置的SSH keys 中
cat ~/.ssh/id_ed25519.pub - Click the
setting button - Click the
SSH Public Keys button - Click the
Add key button - Add the info of the public key and save.
- 可以在
~/.ssh/config 配置文件中指定认证选项,明确指定认证文件(不是必须的) 比如:
Host your.gerrit.host
IdentityFile ~/.ssh/id_ed25519
- 或者在
~/.ssh/config 配置文件中指定客户端接受RSA 密钥(不推荐)
PubkeyAcceptedKeyTypes +ssh-rsa
如
Host *
ServerAliveInterval 120
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
PubkeyAcceptedKeyTypes +ssh-rsa
-
verify whether the ssh config is ok ssh -p 29418 USER@SERVER_IP or add -vv option to see detailed information. ssh -vv -p 29418 USER@SERVER_IP -
config git
- config username and email
git config --global user.name YOUR_USERNAME
git config --global user.email YOUR_EMAIL
use your real github or gerrit username instead of YOUR_USERNAME, No square brackets use your real email value instead of YOUR_EMAIL, No square brackets
git config --global core.editor vim
git config --global commit.template ~/.git.commit.template.txt
edit commit template file, eg: ~/.git.commit.template.txt
[id][platform][module] short message
Release note:
-problem:
-solution:
-author:
-reviewer:
Test:
1.
2.
|