Gitblit介绍
Gitblit 是一个纯 Java 库用来管理、查看和处理 Git 资料库.至关于 Git 的 Java 管理工具,支持linux系统。
Git是分布式版本控制系统,它强调速度、数据一致性,而且支持分布式、非线性工做流。它最初由Linus Torvalds在2005年为Linux内核设计和开发,使用GPLv2证书,
并今后成为软件开发中使用最普遍的版本控制系统。
Gitblit是彻底开源的软件,它基于纯粹的Java堆栈,被设计以在Git仓库速度和效率方面胜任从小型到极大型的项目。它很容易学习和上手,并有着闪电般的性能。它在很
多方面远胜Subversion、CVS、Perforce和ClearCase等SCM(版本控制)工具,好比,如快速本地分支、易于暂存、多工做流等。java
下面介绍Gitblit的安装(Ubuntu/Fedora/CentOS)node
Git是一款注重速度、数据完整性、分布式支持和非线性工做流的分布式版本控制工具。Git最初由Linus Torvalds在2005年为Linux内核开发而设计,现在已经成为被广
泛接受的版本控制系统。和其余大多数分布式版本控制系统比起来,不像大多数客户端-服务端的系统,每一个Git工做目录是一个完整的仓库,带有完整的历史记录和完整的版本
跟踪能力,不须要依赖网络或者中心服务器。像Linux内核同样,Git也是在GPLv2许可证下分发的自由软件。linux
[root@gitblit-server ~]# yum -y install java-1.7.0-openjdk* //要提早安装java环境 [root@gitblit-server ~]# mkdir -p /opt/gitblit [root@gitblit-server ~]# cd /opt/gitblit [root@gitblit-server gitblit]# wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz [root@gitblit-server gitblit]# tar -zvxf gitblit-1.6.2.tar.gz [root@gitblit-server gitblit]# ls add-indexed-branch.sh ext gitblit-stop.sh java-proxy-config.sh reindex-tickets.sh authority.sh gitblit-1.6.2.tar.gz install-service-centos.sh LICENSE service-centos.sh data gitblit.jar install-service-fedora.sh migrate-tickets.sh service-ubuntu.sh docs gitblit.sh install-service-ubuntu.sh NOTICE 默认配置文件在data/gitblit.properties,能够根据须要本身修改。 启动gitlit服务: 第一种方式:经过service命令: [root@gitblit-server gitblit]# cp service-centos.sh /etc/init.d/gitblit [root@gitblit-server gitblit]# chkconfig --add gitblit [root@gitblit-server gitblit]# service gitblit start Starting gitblit server . [root@gitblit-server gitblit]# ps -ef|grep gitblit root 7421 1 99 11:19 pts/0 00:00:13 java -server -Xmx1024M -Djava.awt.headless=true -jar /opt/gitblit/gitblit.jar --httpsPort 8443 --httpPort 0 --baseFolder /opt/gitblit/data --dailyLogFile root 7447 7217 0 11:19 pts/0 00:00:00 grep gitblit 第二种方式,手动启动: [root@gitblit-server gitblit]# java -jar gitblit.jar --baseFolder data 2017-05-31 11:51:17 [INFO ] ***************************************************************** 2017-05-31 11:51:17 [INFO ] _____ _ _ _ _ _ _ 2017-05-31 11:51:17 [INFO ] | __ \(_)| | | | | |(_)| | 2017-05-31 11:51:17 [INFO ] | | \/ _ | |_ | |__ | | _ | |_ 2017-05-31 11:51:17 [INFO ] | | __ | || __|| '_ \ | || || __| 2017-05-31 11:51:17 [INFO ] | |_\ \| || |_ | |_) || || || |_ 2017-05-31 11:51:17 [INFO ] \____/|_| \__||_.__/ |_||_| \__| 2017-05-31 11:51:17 [INFO ] Gitblit v1.6.2 2017-05-31 11:51:17 [INFO ] 2017-05-31 11:51:17 [INFO ] ***************************************************************** 2017-05-31 11:51:17 [INFO ] Running on Linux (2.6.32-642.el6.x86_64) 2017-05-31 11:51:17 [INFO ] Logging initialized @1233ms 2017-05-31 11:51:17 [INFO ] Using JCE Unlimited Strength Jurisdiction Policy files 2017-05-31 11:51:17 [INFO ] Setting up HTTPS transport on port 8443 2017-05-31 11:51:17 [INFO ] certificate alias = localhost 2017-05-31 11:51:17 [INFO ] keyStorePath = /opt/gitblit/data/serverKeyStore.jks 2017-05-31 11:51:17 [INFO ] trustStorePath = /opt/gitblit/data/serverTrustStore.jks 2017-05-31 11:51:17 [INFO ] crlPath = /opt/gitblit/data/certs/caRevocationList.crl ........ 确保gitblit的8443端口已打开 [root@gitblit-server gitblit]# lsof -i:8443 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME java 7421 root 94u IPv6 1224421 0t0 TCP *:pcsync-https (LISTEN)
打开浏览器,依据你的配置进入https://localhost:8443。 输入默认的管理员受权:admin / admin 并点击Login 按钮git
添加用户操做ubuntu
添加仓库操做centos
这样就在组huanqiu下建立了hqpc的代码仓库。还能够在huanqiu组下建立其它的仓库浏览器
能够是用上面建立的wangshibo用户登录,而后将客户机的ssh公钥添加到gitblit的wangshibo用户下,这样就能使用ssh方式进行操做了。bash
添加客户机公钥,能够设置操做权限(读写权限)服务器
而后就能够在客户机上进行代码操做了网络
[root@Agent-node1 ~]# cd /opt [root@Agent-node1 opt]# git clone ssh://wangshibo@182.48.115.233:29418/huanqiu/hqpc.git Initialized empty Git repository in /opt/hqpc/.git/ warning: remote HEAD refers to nonexistent ref, unable to checkout. [root@Agent-node1 opt]# ls hqpc [root@Agent-node1 opt]# cd hqpc/ [root@Agent-node1 hqpc]# echo "123123" > test.txt [root@Agent-node1 hqpc]# git add test.txt [root@Agent-node1 hqpc]# git commit -m "added by wangshibo" [master (root-commit) fd709a4] added by wangshibo Committer: root <root@Agent-node1.(none)> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com //能够在操做下执行这两行,进行全局设置(不操做也行) If the identity used for this commit is wrong, you can fix it with: git commit --amend --author='Your Name <you@example.com>' 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 test.txt [root@Agent-node1 hqpc]# git push -u origin master Counting objects: 3, done. Writing objects: 100% (3/3), 222 bytes, done. Total 3 (delta 0), reused 0 (delta 0) remote: Updating references: 100% (1/1) To ssh://wangshibo@182.48.115.233:29418/huanqiu/hqpc.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
而后登录到gitblit页面,查看test.txt文件是否已经成功推到了hqpc仓库里了
--------------------------------------------------------------------------
还能够设置用户的访问权限
中英文显示,能够在"用户中心"的"偏好设置"里选择中文或是英文显示
能够在"个人公告板"里查看最近的操做记录状况