这个教程是拿到新的服务器之后的配置过程,分享出来供大家参考。
ssh 配置
首先需要配置自己的公钥
- 如果已经有公钥和私钥,复制到 ~/.ssh/ 文件夹中
chmod 400 id_rsa*
- 如果没有,需要重新创建,一路回车就行
ssh-keygen -t rsa -C "yourname@example.com"
cat ~/.ssh/id_rsa.pub
将公钥内容添加到你的gerrit账户的“SSH public Keys”中
3. 如果不想每次都输入密码,输入下面的命令取消
ssh-agent bash
ssh-add ~/.ssh/id_rsa
gerrit配置
这一部分一般需要配置name,email,以及对应的url.ssh作为检验
git config --global user.name yourname
git config --global user.email yourname@example.com
git config --global url.ssh://hostname:port.insteadof ssh//hostname
如果user.name和user.email输入错了,重新输入一次就行了
如果url.ssh写错了,需要用以下命令删除
git config --global --remove-section url.ssh://username@host:port
repo配置
repo配置有一下几个步骤
1. 创建~/bin/文件夹 命令为 mkdir ~/bin/
2. 添加~/bin/到环境变量中,在.bashrc文件中添加 export PATH=”~/bin:$PATH” 如果没有.bashrc,请自行创建
3. 按管理员给的文档下载repo工具,curl http://hostname:port/static/repo > ~/bin/repo
4. 修改repo权限 chmod a+x ~/bin/repo