gerrit及git的基本安装使用
2017-05-30 10:18
423 查看
1、gerrit安装:
1、下载gerrit.war的安装包后执行:
java -jar gerrit-2.2.2.war init --batch -d ~/gerrit_testsite
2、git config -f ~/gerrit_testsite/etc/gerrit.config gerrit.canonicalWebUrl
3、修改~/gerrit_testsite/etc/gerrit.config 里的配置
4、~/gerrit_testsite/bin/gerrit.sh restart
4、访问:http://192.168.6.201:8080
2、验证问题,可以把gerrit下etc里的config的auth改为type = DEVELOPMENT_BECOME_ANY_ACCOUNT
正式环境用http验证方式,apache配置里用:
Listen 80
<VirtualHost *:80>
ServerName 192.168.6.201
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
AuthType Basic
AuthName "Welcomme to Gerrit Code Review Site!"
Require valid-user
AuthUserFile /var/www/html/passwd #这里记得配置好路径,让apache有权限去读取这个文件,发生错误就看apache的error日志
</Location>
ProxyPass / http://192.168.6.201:8080/
proxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
添加邮件没收到邮件验证时,查看:/var/mail/root
3、客户端连接的时候显示:no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
则在执行前运行: export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'
或在~/.ssh/config加上:
Host *
KexAlgorithms +diffie-hellman-group1-sha1
4、测试连接:ssh -vT -i ~/.ssh/id_dsa.pub -p 29418 -o KexAlgorithms=+diffie-hellman-group1-sha1 junqing124@192.168.6.201 这里的启用在gerrit里的setting里的Profile里的Username
5、客户端用 ssh-keygen.exe -t rsa这个去生成,然后把id_rsa.pub里的内容添加到gerrit里去
6、fatal: Not a git repository (or any of the parent directories): .git则先git init
7、git常用操作:
测试:ssh -p 29418 junqing124@192.168.6.201
创建仓库: ssh -p 29418 junqing124@192.168.6.201 gerrit create-project --empty-commit --name demo-project
clone: git clone ssh://junqing124@192.168.6.201:29418/demo-project.git /i/gerrit_test
init:git init
更新:
git fetch ssh://junqing124@192.168.6.201:29418/demo-project.git && git checkout FETCH_HEAD
合并:git pull --rebase origin master
add:git add .
commit:git commit -m 'test'
获取:git pull origin master
reviewer的权限设置:http://openwares.net/linux/gerrit_privilege_setup.html
合并删除分支:http://www.cnblogs.com/kevingrace/p/5688724.html
查看本地分支:git branch
查看远程分支:git branch -a
删除文件恢复:
删除文件查看:git ls-files --deleted
恢复全部文件:git ls-files -d | xargs git checkout --
恢复指定文件:git checkout -- file_name
查看log:
git log file_name
git log --pretty=oneline file_name //显示版本号和描述
查看恢复的版本log:
git reflog
返回指定版本:
git reset --hard 版本号(版本号没必要写全,前几位就可以了)
8、使用Tortoisegit
http://loiy.net/post/524.html
1、下载gerrit.war的安装包后执行:
java -jar gerrit-2.2.2.war init --batch -d ~/gerrit_testsite
2、git config -f ~/gerrit_testsite/etc/gerrit.config gerrit.canonicalWebUrl
3、修改~/gerrit_testsite/etc/gerrit.config 里的配置
4、~/gerrit_testsite/bin/gerrit.sh restart
4、访问:http://192.168.6.201:8080
2、验证问题,可以把gerrit下etc里的config的auth改为type = DEVELOPMENT_BECOME_ANY_ACCOUNT
正式环境用http验证方式,apache配置里用:
Listen 80
<VirtualHost *:80>
ServerName 192.168.6.201
ProxyPreserveHost On
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
AuthType Basic
AuthName "Welcomme to Gerrit Code Review Site!"
Require valid-user
AuthUserFile /var/www/html/passwd #这里记得配置好路径,让apache有权限去读取这个文件,发生错误就看apache的error日志
</Location>
ProxyPass / http://192.168.6.201:8080/
proxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>
添加邮件没收到邮件验证时,查看:/var/mail/root
3、客户端连接的时候显示:no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
则在执行前运行: export GIT_SSH_COMMAND='ssh -o KexAlgorithms=+diffie-hellman-group1-sha1'
或在~/.ssh/config加上:
Host *
KexAlgorithms +diffie-hellman-group1-sha1
4、测试连接:ssh -vT -i ~/.ssh/id_dsa.pub -p 29418 -o KexAlgorithms=+diffie-hellman-group1-sha1 junqing124@192.168.6.201 这里的启用在gerrit里的setting里的Profile里的Username
5、客户端用 ssh-keygen.exe -t rsa这个去生成,然后把id_rsa.pub里的内容添加到gerrit里去
6、fatal: Not a git repository (or any of the parent directories): .git则先git init
7、git常用操作:
测试:ssh -p 29418 junqing124@192.168.6.201
创建仓库: ssh -p 29418 junqing124@192.168.6.201 gerrit create-project --empty-commit --name demo-project
clone: git clone ssh://junqing124@192.168.6.201:29418/demo-project.git /i/gerrit_test
init:git init
更新:
git fetch ssh://junqing124@192.168.6.201:29418/demo-project.git && git checkout FETCH_HEAD
合并:git pull --rebase origin master
add:git add .
commit:git commit -m 'test'
获取:git pull origin master
reviewer的权限设置:http://openwares.net/linux/gerrit_privilege_setup.html
合并删除分支:http://www.cnblogs.com/kevingrace/p/5688724.html
查看本地分支:git branch
查看远程分支:git branch -a
删除文件恢复:
删除文件查看:git ls-files --deleted
恢复全部文件:git ls-files -d | xargs git checkout --
恢复指定文件:git checkout -- file_name
查看log:
git log file_name
git log --pretty=oneline file_name //显示版本号和描述
查看恢复的版本log:
git reflog
返回指定版本:
git reset --hard 版本号(版本号没必要写全,前几位就可以了)
8、使用Tortoisegit
http://loiy.net/post/524.html
相关文章推荐
- Git的基本使用和安装
- Git on Windows 安装和基本使用
- Gerrit与Git安装及使用手册
- git安装和基本使用(平台为ubuntu12.04 64bit)
- 【教程】Git在Eclipse中的安装和基本使用
- Git安装及基本使用
- git的安装与基本使用方法
- Git(二):Git的安装配置与基本使用
- GIT 的安装和基本使用
- Git的基本使用方法和安装&心得体会(使用git命令行)
- Git安装、使用教程、遇到的问题和基本常用命令合集
- Git的基本使用方法和安装&心得体会
- Git安装及基本使用
- git安装配置及基本使用
- Git 安装及基本使用
- Git Review + Gerrit 安装及使用完成 Code-Review
- git学习篇1——git的安装和基本使用
- Windows下Git的安装和基本使用方法
- 关于IDEA的基本环境配置以及快速使用(git拉载程序,Jdk安装,tomcat部署,应用程序打包运行)
- Git使用技巧(2)-- 基本操作