git与ssh配置方法及注意事项

git与ssh配置方法及注意事项

配置ssh key

  1. 生成ed25519密钥
    ssh-keygen -t ed25519 -C YOUR_EMAIL

use your real email value instead of YOUR_EMAIL

将私钥添加到身份验证代理
ssh-add

  1. ~/.ssh/id_ed25519.pub的文本添加到gerritgit用户配置的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.
  1. 可以在~/.ssh/config配置文件中指定认证选项,明确指定认证文件(不是必须的)
    比如:
Host your.gerrit.host
IdentityFile ~/.ssh/id_ed25519
  1. 或者在~/.ssh/config配置文件中指定客户端接受RSA密钥(不推荐)
PubkeyAcceptedKeyTypes +ssh-rsa

Host *
ServerAliveInterval 120

IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
PubkeyAcceptedKeyTypes +ssh-rsa
  1. 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

  2. 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

  • config editor
git config --global core.editor vim
  • set commit template
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.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值