Self Host Git Server Based on Gitblit
OS: CentOS 7
Gitblit provides normal Git server and a easy-use Web panel
project official site: http://www.gitblit.com/
- Open Source (Apache License 2.0)
- Based on JAVA 7 and Support JAVA API
- Multiple Authentication
- Use Groovy Scripts
What about shortcomings?
Based on JAVA, so not friendly to low-performance machine
However, if you machine have at least one gigabyte memory, I think it should be fine.
- Use Groovy Scripts instead of Shell as hooks of Git
Install JRE and JDK
Because Gitblit are written in JAVA 7, we need JDK 1.7
yum -y install java-1.7.0-openjdk*
if you have multiple JDK environment, make sure you could deal with the switch of versions of JDK!
- Go to the official site to find link like
Make folder and Download
mkdir -p /opt/gitblit #make folder cd /opt wget http://dl.bintray.com/gitblit/releases/gitblit-1.8.0.tar.gz #please replace the link with the latest one tar -zvxf gitblit* mv gitblit-1.8.0 gitblit cd gitblit
make sure you have backup
search these and configure as you want
server.httpPort server.httpsPort git.sshPort
tips about port settings:
you could use
lsof -i :portNumberto find whether the port has been used
change these as above
service gitblit start
visit the web, and you could see
Default administrator username:
Default administrator password:
For default settings, the certificate comes from Linux kernel, if you have installed one.
However, for most of time, I would like to use Nginx to proxy it.
From my perspective, one of the most important things about Git is hooks. In Gitblit, you could write these scrips in Groovy, following built-in scripts at
For example, a post-Receive scripts for copying codes from master branch of a repository:
- edit some lines in
def rootFolder = 'your original Dir' def cloneAllBranches = false def cloneBranch = 'refs/heads/master'
And enable the hook in Receive menu.
- More settings and Plugins
See the official website.
But I consider them helpless for individual use.
版权声明：本文为原创文章，版权归 Haolin Zhang 所有。