Gerrit 服务器入门使用-项目的创建与克隆
2024-09-02 20:38:39
Gerrit 服务器入门使用-项目的创建与克隆
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.创建克隆项目
1>.点击"BROWSE"
2>.点击"CREATE NEW"
3>.项目创建成功
二.基于HTTP方式克隆项目
1>.克隆项目
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total
drwxrwxr-x gerrit gerrit Jun : soft
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ git clone "http://172.30.1.201:8080/yinzhengjie-code"
Cloning into 'yinzhengjie-code'...
remote: Counting objects: , done
remote: Finding sources: % (/)
remote: Total (delta ), reused (delta )
Unpacking objects: % (/), done.
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total
drwxrwxr-x gerrit gerrit Jun : soft
drwxrwxr-x gerrit gerrit Jun : yinzhengjie-code
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ ll yinzhengjie-code/
total
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$
2>.查看Gerrit的用户名
3>.在git上配置和Gerrit上存在的用户名和邮箱(要进入到已经克隆的项目中)
[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total
drwxrwxr-x gerrit gerrit Jun : soft
drwxrwxr-x gerrit gerrit Jun : yinzhengjie-code
[gerrit@node201.yinzhengjie.org.cn ~]$ cd yinzhengjie-code/
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$ git config user.name "jason"
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$ git config user.email "y1053419035@qq.com"
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$
4>.下载commit-msg
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$ curl -Lo .git/hooks/commit-msg http://172.30.1.201:8080/tools/hooks/commit-msg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
2119k --:--:-- --:--:-- --:--:-- 2334k
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$
三.通过ssh方式克隆项目
1>.创建密钥
[root@node203.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:jjm9d783Ac7qfftXmgCPRmI6fJ/5yf74YHZSi4ofw7I root@node203.yinzhengjie.org.cn
The key's randomart image is:
+---[RSA ]----+
| |
| |
| |
| o o . |
| . oSo +o o |
| +=..o o= o.|
| +o+o+oB.ooo|
| . ==Oo*ooo|
| Eo+=*=*+*|
+----[SHA256]-----+
[root@node203.yinzhengjie.org.cn ~]#
2>.点击设置
3>.点击“SSH Keys”
4>.点击"SSH keys",将公钥拷贝到Gerrit上后点击"ADD NEW SSH KEY"
5>.公钥添加成功
6>.查看ssh的克隆命令
7>.使用ssh的方式克隆代码
[root@node203.yinzhengjie.org.cn ~]# ll
total
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# git clone "ssh://jason@node201.yinzhengjie.org.cn:29418/yinzhengjie-code"
Cloning into 'yinzhengjie-code'...
The authenticity of host '[node201.yinzhengjie.org.cn]:29418 ([172.30.1.201]:29418)' can't be established.
ECDSA key fingerprint is SHA256:Mx8JcnxxxM/b99YiBG6+S8JP8Q12GNFYz0g/+YO4c0.
ECDSA key fingerprint is MD5:c0:2a:ae::::7b:fb::b3:e8:a5:d9:::6a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[node201.yinzhengjie.org.cn]:29418,[172.30.1.201]:29418' (ECDSA) to the list of known hosts.
remote: Counting objects: , done
remote: Finding sources: % (/)
remote: Total (delta ), reused (delta )
Receiving objects: % (/), done.
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# ll
total
drwxr-xr-x root root Jun : yinzhengjie-code
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# ll yinzhengjie-code/
total
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]#
8>.使用另一种方式进行克隆
[root@node203.yinzhengjie.org.cn ~]# ssh -p jason@172.30.1.201 **** Welcome to Gerrit Code Review **** Hi jason, you have successfully connected over SSH. Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use: git clone ssh://jason@node201.yinzhengjie.org.cn:29418/REPOSITORY_NAME.git #我们根据提示,这种克隆方式也是ok的 Connection to 172.30.1.201 closed.
[root@node203.yinzhengjie.org.cn ~]#
最新文章
- SharePoint 2010 数据库xxx的事务日志已满
- ng-switch
- nodeType、nodeName和nodeValue
- .frame类库简单介绍与使用
- C++开源大全
- springmvc学习笔记--支持文件上传和阿里云OSS API简介
- JVM垃圾收集策略解析
- centos 下 yum安装和卸载软件
- php中对共享内存,消息队列的操作
- oracle dblink使用
- JAVA存取对象属性时,如果开程多线程,记得对相关存取方法作原子化操作定义
- iOS:编译错误Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX&;quot;, referenced from: error
- html超级简单实现点赞(收藏)和取消赞效果
- Graph图总结
- oracle的存储过程的作用
- 尚硅谷springboot学习30-docker安装mysql示例
- 直播协议的选择:RTMP vs. HLS
- sublime3 快速创建html模板
- Java遍历集合的几种方法分析(实现原理、算法性能、适用场合)
- vue的watcher 关于数组和对象