Git Gerrit Repo User Manual
Git Repo Gerrit User Manual
Revision History
|
Revision # |
Description |
Date |
Author |
|
0.1 |
Initial this document |
2014/09/05 |
Deman Lu |
|
0.2 |
Add First time push Code to Gerrit |
2014/09/09 |
Deman Lu |
|
0.21 |
Add FAQ |
2014/09/09 |
Deman Lu |
Contents
Preparation....................................................................................................................... 4
Install............................................................................................................................... 4
Git Setup:.................................................................................................................. 4
Git Config:................................................................................................................ 4
Set Commit Template:................................................................................................. 4
Set git ignore............................................................................................................. 4
Install Repo................................................................................................................ 5
Gerrit Config:............................................................................................................ 5
Get First Project................................................................................................................ 7
FAQ................................................................................................................................. 8
No Branch Ready For Upload Error.......................................................................... 8
CONFLICT Error..................................................................................................... 8
Upload Merges
Error................................................................................................ 9
Repo init Error......................................................................................................... 9
Repo syntax error near unexpected token `newline'................................................... 9
Repo init Connect Error:.......................................................................................... 9
Everything up-to-date:........................................................................................... 9
Preparation
OS: Linux or Ubuntu
Software: Git, SSH, Repo
Install
Git Setup:
$ sudo apt-get install git
$ sudo apt-get install git-core
$ git version // version >= 1.6
Git Config:
$ git config --global user.name "deman_lu"
将user name为你gerrit系统的账号(邮箱地址(全小写的前缀))
$ git config --global user.email "deman_lu@htc.com"
将user email设置成你htc的邮箱(邮箱地址全小写)
$ git config --global core.editor vim
$ git config --global merge.tool vimdiff
$ git config --global color.ui
"auto"
Set Commit Template:
$ vim ~/.git-template
Symptom:
Bug ID:
Root Cause:
Solution:
Note:
$ git config --global commit.template
~/.git-template
Set git ignore
$ vim ~/.gitignore
$ git config --global core.excludesfile
~/.gitignore
Install Repo
$ cd
$ mkdir bin
$ cd bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo
> ~/bin/repo
If you can’t connect google, you can copy
repo from:
\\10.33.8.3\cht000\CHT200\CHT210\CHT211\Trainning\
COS_Android\Git&Repo\bin
$ chmod a+x ~/bin/repo
Gerrit Config:
Gerrit Web: http://10.33.137.230/project/
Add public Key:
$ ssh-keygen -t rsa
If you have
ssh key, you can use
it directly。
$ cat ~/.ssh/id_ras.pub
Select [Setting] ==> [SSH Public Key]
Press Add key, and paste your id_rsa.pub content into edit text then added.
Add Server host key to known_hosts:
$ vim ~/.ssh/known_hosts
Paste the host key from below image showing
to known_hosts.
$ vim ~/.ssh/config
host gerrit
user deman_lu
hostname 10.33.137.230
port 29418
identityfile ~/.ssh/id_rsa
$ ssh gerrit
**** Welcome to Gerrit Code
Review ****
Hi
Deman_Lu, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To
clone a hosted Git repository, use:
git
clone ssh://deman_lu@10.33.137.230:29418/REPOSITORY_NAME.git
Connection to 10.33.137.230 closed.
If you want to see more detail:
http://10.116.121.47/mediawiki/index.php/Git_Repo_Gerrit_User_Manual
Get First Project
Using following command to get repository.
$ repo init -u
ssh://deman_lu@10.33.137.230:29418/manifest.git -m
team1.xml
The highlight is the manifest.xml,please connect Administrator to get
your manifest.xml
If you just want to do some practices, you
can ignore it and it will download default project.
$ repo sync
$repo forall -c "git checkout -b
master origin/master"
This will create branch master and connect
origin branch origin/master.
Thus, you can push your code to
origin/master
$ repo upload
--re=bill_tan,deman_lu
FAQ
No Branch Ready For Upload Error
Check if it is in some branch
$ git branch
If no branch, change to master branch.
$ git checkout master
Modify some files and commit
$ repo upload --re=<User Name>
After doing below thing, you also meet
these error:
Clean the repo and delete ~/.repoconfig
Please according to “Git First Project” step
by step.
CONFLICT Error
hailong@hailong-Lenovo:~/test/localhost/gerrit/repo/test$
repo sync
remote: Counting objects: 5, done
remote: Finding sources: 100% (3/3)
remote: Total 3 (delta 2), reused 3 (delta
2)
Unpacking objects: 100% (3/3), done.
From ssh://localgerrit:29418/new/test
fdcfcac..5f7a5f9 master -> origin/master
project test/
First, rewinding head to replay your work
on top of it...
Applying: m_cm_6.2
Using index info to reconstruct a base
tree...
Falling back to patching base and 3-way
merge...
Auto-merging readme.txt
CONFLICT (content): Merge
conflict in readme.txt
Recorded preimage for 'readme.txt'
Failed to merge in the changes.
Patch failed at 0001 m_cm_6.2
You should manual merge file when repo
sync.
$ git add readme.txt
$ git rebase --continue
Upload
Merges Error
When repo upload: ![remote rejected] master ->
refs/for/master (you are not allowed to upload merges)
Reason: you have doing some merge but
gerrit not allow.
Solution: reset your merge and using git
rebase to commit.
$ git reset --hard <commit id>
$ git fetch
$ git rebase origin/master
$ repo upload --re=<User Name>
Repo init
Error
Repo int: fatal: Cannot get https://code.google.com/p/git-repo/clone.bundle
fatal: error [Errno 104] Connection reset
by peer
Solution: $ vim ~/bin/repo modify
REPO_URL='http://android.googlesource.com/tools/repo'
Repo syntax error near unexpected token `newline'
/root/bin/repo: line 1: syntax error near
unexpected token `newline'
/root/bin/repo: line 1: `<!DOCTYPE html>'This problem is that repo’s
version is too old, using a new one.
$ curl
http://git-repo.googlecode.com/files/repo-1.12> ~/bin/repo
Or copy repo file form other members.
Repo init Connect Error:
fatal: Cannot get
https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: HTTP error 403
When repo init, repo will download code
from google, so, the reason is you known.
Please try more times or do it later.
Everything up-to-date:
$ git push showing :every thing up to date,
but you also have not push anthing!
$ git push origin master : this will be
denied by gerrit, you can’t push code to git repository directly.
We must push to review repository:
$git push origin HEAD:refs/for/master
Git Gerrit Repo User Manual的更多相关文章
- How to get started with GIT and work with GIT Remote Repo
https://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html#zz-7. 1. Introduction GIT is a ...
- Git和Repo管理使用简要介绍
在Linux平台下进行Android系统项目开发时,需要Git或repo管理. 一. Git和Repo的区别: 1. Git:Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的 ...
- Git和Repo管理使用
Git和Repo管理使用简要介绍 http://blog.csdn.net/stevenhu_223/article/details/8828130 多仓库代码管理器Repo的安装,使用以及服务器搭建 ...
- 常用的git和repo命令
首先下图是git的流程图 相关概念 svn与git命令的对比 git常用命令 git log // 查看当前库的git log信息 git status ./ // 查看当前库的状态 git diff ...
- Git与Repo入门(转载)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAykAAADuCAIAAACyDd+sAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4Xu ...
- 【转】Android源码学习(2)使用Git和Repo进行版本管理
原文网址:http://blog.chinaunix.net/uid-26074270-id-2458828.html Android项目采用Git和Repo进行版本管理.在大多数情况下,Git都可以 ...
- 【转】Git与Repo入门----不错
原文网址:http://www.cnblogs.com/angeldevil/p/3238470.html Git与Repo入门 版本控制 版本控制是什么已不用在说了,就是记录我们对文件.目录或工 ...
- Git Gerrit使用
Git Gerrit 操作都用 git bash操作: 如果想用 cmd 或者 PowerShell,系统环境变量 Path 添加 Git 安装路径,如: C:\Program Files (x86) ...
- Git 和 Repo常用命令
这篇博客总结的也不错: git常用及进阶命令总结 Git与Repo入门 一.初始環境配置 git config --global user.name "John Doe"git c ...
随机推荐
- POJ2513_Colored Sticks_KEY
题目传送门 题目大意:给你若干根木棍,每根木棍有前后两种颜色,连接两根木棍需要前后颜色相同,求能否将所有木棍连接在一起. Solution: 不要将木棍看成点,将颜色看成点. 其实就是求是否存在欧拉路 ...
- IBM X3650M4简单排错方法
如果出问题了,首先看开机的那个地方的灯是否显示正常,有黄色的灯亮一般都不正常: 这种服务器带有一个错误指示板,只需要在电源开关那,如上图,把那个蓝色的按钮往里面按,就能把里面的一个板子抽出来,可以看到 ...
- C# 远程图片下载到本地
下载方法 using System; using System.Net; using System.IO; using System.Text; namespace Common { /// < ...
- C#之Lambda不得不说的用法
由于我才开始接触代码的时候遇到循环问题都是用foreach和for,慢慢就成了习惯,不愿意用其他简便的方式,偶然发现lambda能代替循环而且简便了很多.当然我用lambda也不是简便,更多是不用不行 ...
- RabbitMQ入门:在Spring Boot 应用中整合RabbitMQ
在上一篇随笔中我们认识并安装了RabbitMQ,接下来我们来看下怎么在Spring Boot 应用中整合RabbitMQ. 先给出最终目录结构: 搭建步骤如下: 新建maven工程amqp 修改pom ...
- 换Mac了,迈入了终端的大门
多终端其实本质和多线程一样,所有终端其实都共享着同一个内存只不过不同终端对共享内存不同部分的权限不同罢了所以对终端的数量必须要有限制 我这里开启了四个线程,很明显四个线程都在跑同一个内存而且四个线程都 ...
- hive的简单使用
一.一些说明 1.支持的操作 hive 默认不支持updata 和 delete操作 insert也是执行缓慢,主要用于数据的计算 hive 数据类型---字符串,大部分与java一致. 2.内外表的 ...
- leetcode个人题解——#43 Multiply Strings
思路:高精度乘法就可以了. 有两个错误以前没在意,1.成员属性定义时候不能进行初始化, vector<); 这样隐性调用了函数进行初始化的形式特别要注意,也是错误的: 2.容器类只有分配了空间时 ...
- react native基础与入门
react native基础与入门 一.react native 的优点 1.跨平台(一才两用) 2.低投入高回报 (开发成本低.代码复用率高) 3.性能高:拥有独立的js渲染引擎,比传统的h5+ w ...
- Spring演示及总结
一.目标 二.分工 三.回顾 发现问题: 第一个冲刺的任务以基本完成,但队友的状态相对有些疲软,主要原因可能是这两周有好几个课程大作业要赶, 有的队友还要为比赛做准备,及做一些其他是项目,时间较紧,有 ...