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倉庫裏了
--------------------------------------------------------------------------
還能夠設置用戶的訪問權限
中英文顯示,能夠在"用戶中心"的"偏好設置"裏選擇中文或是英文顯示
能夠在"個人公告板"裏查看最近的操做記錄狀況