If you've already generated it, you don't need to regenerate it !
else:
$ssh-keygen -t rsa -C your-email
Now the public key will be located in ~/.ssh/id_rsa.pub
$cat ~/.ssh/id_rsa.pub
• Open web of gerrit , sign in
• Click “Settings” and then “SSH Public keys”. Paste the entire contents of your ~/.ssh/id_rsa.pub into the textbox and click the “add” button.
$sudo apt-get install vim (you need know a little VIM, if not, please use gedit)
$vi ~/.ssh/config or gedit ~/.ssh/config
Paste and edit the following content:
Host gerrit1
HostName XXXXX
Port 29418
User your-gerrit-login-username
IdentityFile ~/.ssh/id_rsa
$chmod og-rwx ~/.ssh/config
$sudo apt-get install git
$git config --global user.email “your-gerrit-email”
$git config --global user.name “your-gerrit-login-username”
$vi ~/.gitconfig
Paste and edit the following content:
[review "http://XXXXX:8080"]
username = your-gerrit-login-username
$ssh gerrit1
If the following information appears, the configuration is successful:
**** Welcome to Gerrit Code Review ****
$mkdir ~/bin
get the repo from your team, and copy repo to ~/bin/
$vi ~/bin/repo
edit the REPO_URL and REPO_REV for your repo
for example
REPO_URL = 'ssh://XXXX/repo'
REPO_REV = 'stable'
$chmod +x ~/bin/repo
$ sudo vi ~/.bashrc
Add a new line at the end:
export PATH=$PATH:~/bin
$source ~/.bashrc
PS:
If you want to get the repo for yourself:
$git clone https://code.csdn.net/kangear/git-repo.git -b stable
$cp git-repo/repo ~/bin
$repo help
If the following information appears, the configuration is successful:
cmd : help
usage: repo COMMAND [ARGS]
repo is not yet installed. Use "repo init" to install it here.
The most commonly used repo commands are:
init Install repo in the current working directory
help Display detailed help on a command
For access to the full online help, install repo ("repo init").
You can use 'git clone XXX' or 'repo init -u XX -m XX -b XX' to sync code.