在Linux系统中安装使用Gitblit的教程
程序员文章站
2022-03-28 19:21:45
这篇文章主要介绍了在Linux系统中安装使用Gitblit的教程,Gitblit是一款开源的Git仓库软件,需要的朋友可以参考下... 15-06-06...
git是一款注重速度、数据完整性、分布式支持和非线性工作流的分布式版本控制工具。git最初由linus torvalds在2005年为linux内核开发而设计,如今已经成为被广泛接受的版本控制系统。
和其他大多数分布式版本控制系统比起来,不像大多数客户端-服务端的系统,每个git工作目录是一个完整的仓库,带有完整的历史记录和完整的版本跟踪能力,不需要依赖网络或者中心服务器。像linux内核一样,git也是在gplv2许可证下分发的*软件。
本篇教程我会演示如何安装 gitlit 服务器。gitlit的最新稳定版是1.6.2。gitblit是一款开源、纯java开发的用于管理、浏览和提供git仓库服务的软件。它被设计成一款为希望托管中心仓库的小型工作组服务的工具。
复制代码
代码如下:mkdir -p /opt/gitblit; cd /opt/gitblit; wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz
列出解压后目录内容:
复制代码
代码如下:root@vps124229 [/opt/gitblit]# ls
./ docs/ gitblit-stop.sh* license service-ubuntu.sh*
../ ext/ install-service-centos.sh* migrate-tickets.sh*
add-indexed-branch.sh* gitblit-1.6.2.tar.gz install-service-fedora.sh* notice
authority.sh* gitblit.jar install-service-ubuntu.sh* reindex-tickets.sh*
data/ gitblit.sh* java-proxy-config.sh* service-centos.sh*
./ docs/ gitblit-stop.sh* license service-ubuntu.sh*
../ ext/ install-service-centos.sh* migrate-tickets.sh*
add-indexed-branch.sh* gitblit-1.6.2.tar.gz install-service-fedora.sh* notice
authority.sh* gitblit.jar install-service-ubuntu.sh* reindex-tickets.sh*
data/ gitblit.sh* java-proxy-config.sh* service-centos.sh*
默认配置文件在data/gitblit.properties,你可以根据需要自己修改。
启动gitlit服务:
通过service命令:
复制代码
代码如下: root@vps124229 [/opt/gitblit]# cp service-centos.sh /etc/init.d/gitblit
root@vps124229 [/opt/gitblit]# chkconfig --add gitblit
root@vps124229 [/opt/gitblit]# service gitblit start
starting gitblit server
root@vps124229 [/opt/gitblit]# chkconfig --add gitblit
root@vps124229 [/opt/gitblit]# service gitblit start
starting gitblit server
.
手动启动:
复制代码
代码如下:root@vps124229 [/opt/gitblit]# java -jar gitblit.jar --basefolder data
2015-01-10 09:16:53 [info ] *****************************************************************
2015-01-10 09:16:53 [info ] _____ _ _ _ _ _ _
2015-01-10 09:16:53 [info ] | __ \(_)| | | | | |(_)| |
2015-01-10 09:16:53 [info ] | | \/ _ | |_ | |__ | | _ | |_
2015-01-10 09:16:53 [info ] | | __ | || __|| '_ \ | || || __|
2015-01-10 09:16:53 [info ] | |_\ \| || |_ | |_) || || || |_
2015-01-10 09:16:53 [info ] \____/|_| \__||_.__/ |_||_| \__|
2015-01-10 09:16:53 [info ] gitblit v1.6.2
2015-01-10 09:16:53 [info ]
2015-01-10 09:16:53 [info ] *****************************************************************
2015-01-10 09:16:53 [info ] running on linux (3.8.13-xxxx-grs-ipv6-64-vps)
2015-01-10 09:16:53 [info ] logging initialized @842ms
2015-01-10 09:16:54 [info ] using jce unlimited strength jurisdiction policy files
2015-01-10 09:16:54 [info ] setting up https transport on port 8443
2015-01-10 09:16:54 [info ] certificate alias = localhost
2015-01-10 09:16:54 [info ] keystorepath = /opt/gitblit/data/serverkeystore.jks
2015-01-10 09:16:54 [info ] truststorepath = /opt/gitblit/data/servertruststore.jks
2015-01-10 09:16:54 [info ] crlpath = /opt/gitblit/data/certs/carevocationlist.crl
2015-01-10 09:16:54 [info ] shutdown monitor listening on port 8081
2015-01-10 09:16:54 [info ] jetty-9.2.3.v20140905
2015-01-10 09:16:55 [info ] no jsp support for /, did not find org.apache.jasper.servlet.jspservlet
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iruntimemanager]----
2015-01-10 09:16:55 [info ] basefolder : /opt/gitblit/data
2015-01-10 09:16:55 [info ] settings : /opt/gitblit/data/gitblit.properties
2015-01-10 09:16:55 [info ] jvm timezone: america/montreal (est -0500)
2015-01-10 09:16:55 [info ] app timezone: america/montreal (est -0500)
2015-01-10 09:16:55 [info ] jvm locale : en_us
2015-01-10 09:16:55 [info ] app locale : <client>
2015-01-10 09:16:55 [info ] pf4j runtime mode is 'deployment'
2015-01-10 09:16:55 [info ] enabled plugins: []
2015-01-10 09:16:55 [info ] disabled plugins: []
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.inotificationmanager]----
2015-01-10 09:16:55 [warn ] mail service disabled.
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iusermanager]----
2015-01-10 09:16:55 [info ] configuserservice(/opt/gitblit/data/users.conf)
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iauthenticationmanager]----
2015-01-10 09:16:55 [info ] external authentication disabled.
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ---- [com.gitblit.transport.ssh.ipublickeymanager]----
2015-01-10 09:16:55 [info ] filekeymanager (/opt/gitblit/data/ssh)
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.irepositorymanager]----
2015-01-10 09:16:55 [info ] repositories folder : /opt/gitblit/data/git
2015-01-10 09:16:55 [info ] identifying repositories...
2015-01-10 09:16:55 [info ] 0 repositories identified with calculated folder sizes in 11 msecs
2015-01-10 09:16:55 [info ] lucene will process indexed branches every 2 minutes.
2015-01-10 09:16:55 [info ] garbage collector (gc) is disabled.
2015-01-10 09:16:55 [info ] mirror service is disabled.
2015-01-10 09:16:55 [info ] alias utf-9 & utf-18 encodings as utf-8 in jgit
2015-01-10 09:16:55 [info ] preparing 14 day commit cache. please wait...
2015-01-10 09:16:55 [info ] 0 repositories identified with calculated folder sizes in 0 msecs
2015-01-10 09:16:55 [info ] built 14 day commit cache of 0 commits across 0 repositories in 2 msecs
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iprojectmanager]----
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.ifederationmanager]----
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.igitblit]----
2015-01-10 09:16:55 [info ] starting services manager...
2015-01-10 09:16:55 [info ] federation passphrase is blank! this server can not be pulled from.
2015-01-10 09:16:55 [info ] fanout pubsub service is disabled.
2015-01-10 09:16:55 [info ] git daemon is listening on 0.0.0.0:9418
2015-01-10 09:16:55 [info ] ssh daemon (nio2) is listening on 0.0.0.0:29418
2015-01-10 09:16:55 [warn ] no ticket service configured.
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.ipluginmanager]----
2015-01-10 09:16:55 [info ] no plugins
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] all managers started.
2015-01-10 09:16:53 [info ] *****************************************************************
2015-01-10 09:16:53 [info ] _____ _ _ _ _ _ _
2015-01-10 09:16:53 [info ] | __ \(_)| | | | | |(_)| |
2015-01-10 09:16:53 [info ] | | \/ _ | |_ | |__ | | _ | |_
2015-01-10 09:16:53 [info ] | | __ | || __|| '_ \ | || || __|
2015-01-10 09:16:53 [info ] | |_\ \| || |_ | |_) || || || |_
2015-01-10 09:16:53 [info ] \____/|_| \__||_.__/ |_||_| \__|
2015-01-10 09:16:53 [info ] gitblit v1.6.2
2015-01-10 09:16:53 [info ]
2015-01-10 09:16:53 [info ] *****************************************************************
2015-01-10 09:16:53 [info ] running on linux (3.8.13-xxxx-grs-ipv6-64-vps)
2015-01-10 09:16:53 [info ] logging initialized @842ms
2015-01-10 09:16:54 [info ] using jce unlimited strength jurisdiction policy files
2015-01-10 09:16:54 [info ] setting up https transport on port 8443
2015-01-10 09:16:54 [info ] certificate alias = localhost
2015-01-10 09:16:54 [info ] keystorepath = /opt/gitblit/data/serverkeystore.jks
2015-01-10 09:16:54 [info ] truststorepath = /opt/gitblit/data/servertruststore.jks
2015-01-10 09:16:54 [info ] crlpath = /opt/gitblit/data/certs/carevocationlist.crl
2015-01-10 09:16:54 [info ] shutdown monitor listening on port 8081
2015-01-10 09:16:54 [info ] jetty-9.2.3.v20140905
2015-01-10 09:16:55 [info ] no jsp support for /, did not find org.apache.jasper.servlet.jspservlet
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iruntimemanager]----
2015-01-10 09:16:55 [info ] basefolder : /opt/gitblit/data
2015-01-10 09:16:55 [info ] settings : /opt/gitblit/data/gitblit.properties
2015-01-10 09:16:55 [info ] jvm timezone: america/montreal (est -0500)
2015-01-10 09:16:55 [info ] app timezone: america/montreal (est -0500)
2015-01-10 09:16:55 [info ] jvm locale : en_us
2015-01-10 09:16:55 [info ] app locale : <client>
2015-01-10 09:16:55 [info ] pf4j runtime mode is 'deployment'
2015-01-10 09:16:55 [info ] enabled plugins: []
2015-01-10 09:16:55 [info ] disabled plugins: []
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.inotificationmanager]----
2015-01-10 09:16:55 [warn ] mail service disabled.
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iusermanager]----
2015-01-10 09:16:55 [info ] configuserservice(/opt/gitblit/data/users.conf)
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iauthenticationmanager]----
2015-01-10 09:16:55 [info ] external authentication disabled.
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ---- [com.gitblit.transport.ssh.ipublickeymanager]----
2015-01-10 09:16:55 [info ] filekeymanager (/opt/gitblit/data/ssh)
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.irepositorymanager]----
2015-01-10 09:16:55 [info ] repositories folder : /opt/gitblit/data/git
2015-01-10 09:16:55 [info ] identifying repositories...
2015-01-10 09:16:55 [info ] 0 repositories identified with calculated folder sizes in 11 msecs
2015-01-10 09:16:55 [info ] lucene will process indexed branches every 2 minutes.
2015-01-10 09:16:55 [info ] garbage collector (gc) is disabled.
2015-01-10 09:16:55 [info ] mirror service is disabled.
2015-01-10 09:16:55 [info ] alias utf-9 & utf-18 encodings as utf-8 in jgit
2015-01-10 09:16:55 [info ] preparing 14 day commit cache. please wait...
2015-01-10 09:16:55 [info ] 0 repositories identified with calculated folder sizes in 0 msecs
2015-01-10 09:16:55 [info ] built 14 day commit cache of 0 commits across 0 repositories in 2 msecs
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.iprojectmanager]----
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.ifederationmanager]----
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.igitblit]----
2015-01-10 09:16:55 [info ] starting services manager...
2015-01-10 09:16:55 [info ] federation passphrase is blank! this server can not be pulled from.
2015-01-10 09:16:55 [info ] fanout pubsub service is disabled.
2015-01-10 09:16:55 [info ] git daemon is listening on 0.0.0.0:9418
2015-01-10 09:16:55 [info ] ssh daemon (nio2) is listening on 0.0.0.0:29418
2015-01-10 09:16:55 [warn ] no ticket service configured.
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] ----[com.gitblit.manager.ipluginmanager]----
2015-01-10 09:16:55 [info ] no plugins
2015-01-10 09:16:55 [info ]
2015-01-10 09:16:55 [info ] all managers started.
打开浏览器,依据你的配置进入http://localhost:8080 或者 https://localhost:8443。 输入默认的管理员授权:admin / admin 并点击login 按钮
添加用户:
添加仓库:
用命令行创建新的仓库:
复制代码
代码如下:touch readme.md
git init
git add readme.md
git commit -m "first commit"
git remote add origin ssh://admin@142.4.202.70:29418/programming.git
git push -u origin master
git init
git add readme.md
git commit -m "first commit"
git remote add origin ssh://admin@142.4.202.70:29418/programming.git
git push -u origin master
从命令行推送已有的仓库:
复制代码
代码如下:git remote add origin ssh://admin@142.4.202.70:29418/programming.git
git push -u origin master
git push -u origin master
完成!