ubuntu는git/repo로gerrit 코드 앞의 로컬 기본 설정을 가져옵니다

2718 단어

1. Create you SSH-key.


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

2. Add your key to Gerrit server.


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

3. Create or edit the file ~/.ssh/config and add configuration.


$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

4. Config Git


$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

 

5. Now to verify your ssh setup is okay and key is working correctly, try to connect to Gerrit’s SSH port:


$ssh gerrit1 If the following information appears, the configuration is successful: ****    Welcome to Gerrit Code Review    ****
 

6.  Install repo


$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
 

7.  Verify repo


$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").

8.   Then, you can request the access permission and try to sync the code.


You can use 'git clone XXX' or 'repo init -u XX -m XX -b XX' to sync code.

좋은 웹페이지 즐겨찾기