1.下載地址java
http://www.gitblit.com/git
2.安裝jdk(自行安裝)bash
3.解壓gitblitapp
# tar -zxvf gitblit-1.8.0.tar.gzmaven
4.配置
# cd gitblit-1.8.0/dataspa
# vi gitblit.propertiesserver
添加如下信息:xml
# SINCE 1.7.0
include = defaults.properties
server.httpPort=81
server.httpBindInterface=192.168.28.130
server.httpsBindInterface=localhostblog
5.啓動和中止rem
1)前臺啓動
# cd gitblit-1.8.0
# ./gitblit.sh
2)後臺啓動
# nohup ./gitblit.sh &
3)中止
# ./gitblit-stop.sh
6.訪問
http://192.168.28.130:81
登錄密碼:admin/admin
7.建立用戶
8.建立團隊
9.建立版本庫
10.分配項目給其餘人員
先分配給組,再分配給組中的成員
11. 把項目提交到創庫中
首先須要在須要提交代碼的機器上安裝git
使用命令以下:
localhost:gitClient mhx$ git clone http://admin@192.168.28.130:81/r/firstDemo.git
Cloning into 'firstDemo'...
warning: You appear to have cloned an empty repository.
localhost:gitClient mhx$ ll
-bash: ll: command not found
localhost:gitClient mhx$ ls
firstDemo gitrepo
localhost:gitClient mhx$ cd firstDemo/
localhost:firstDemo mhx$ ls
localhost:firstDemo mhx$ cp -r /Users/mhx/Downloads/registerdiscovery .
localhost:firstDemo mhx$ ll
-bash: ll: command not found
localhost:firstDemo mhx$ ls
registerdiscovery
localhost:firstDemo mhx$ cd registerdiscovery/
localhost:registerdiscovery mhx$ ls
HELP.md mvnw mvnw.cmd pom.xml src
localhost:registerdiscovery mhx$ cd ..
localhost:firstDemo mhx$ ls
registerdiscovery
localhost:firstDemo mhx$ git add *
localhost:firstDemo mhx$ git commit -m "add new file"
[master (root-commit) cafacf4] add new file
16 files changed, 677 insertions(+)
create mode 100644 registerdiscovery/.DS_Store
create mode 100644 registerdiscovery/.gitignore
create mode 100644 registerdiscovery/.mvn/wrapper/MavenWrapperDownloader.java
create mode 100644 registerdiscovery/.mvn/wrapper/maven-wrapper.jar
create mode 100644 registerdiscovery/.mvn/wrapper/maven-wrapper.properties
create mode 100755 registerdiscovery/mvnw
create mode 100644 registerdiscovery/mvnw.cmd
create mode 100644 registerdiscovery/pom.xml
create mode 100644 registerdiscovery/src/.DS_Store
create mode 100644 registerdiscovery/src/main/.DS_Store
create mode 100644 registerdiscovery/src/main/java/.DS_Store
create mode 100644 registerdiscovery/src/main/java/com/.DS_Store
create mode 100644 registerdiscovery/src/main/java/com/maohx/.DS_Store
create mode 100644 registerdiscovery/src/main/java/com/maohx/registerdiscovery/RegisterdiscoveryApplication.java
create mode 100644 registerdiscovery/src/main/resources/application.properties
create mode 100644 registerdiscovery/src/test/java/com/maohx/registerdiscovery/RegisterdiscoveryApplicationTests.java
localhost:firstDemo mhx$ git push
Password for 'http://admin@192.168.28.130:81':
fatal: Authentication failed for 'http://admin@192.168.28.130:81/r/firstDemo.git/'
localhost:firstDemo mhx$ push
-bash: push: command not found
localhost:firstDemo mhx$ git push
Password for 'http://admin@192.168.28.130:81':
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (26/26), done.
Writing objects: 100% (33/33), 50.55 KiB | 12.64 MiB/s, done.
Total 33 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5)
remote: Updating references: 100% (1/1)
To http://192.168.28.130:81/r/firstDemo.git
* [new branch] master -> master
localhost:firstDemo mhx$
12.建立分支
localhost:firstDemo mhx$ ls
registerdiscovery
localhost:firstDemo mhx$ git checkout -b embrace1.0
Switched to a new branch 'embrace1.0'
localhost:firstDemo mhx$ git branch
* embrace1.0
master
localhost:firstDemo mhx$ git commit -m "add new branch"
On branch embrace1.0
nothing to commit, working tree clean
localhost:firstDemo mhx$ git push -u origin embrace1.0
Total 0 (delta 0), reused 0 (delta 0)
remote: Updating references: 100% (1/1)
To http://192.168.28.130:81/r/firstDemo.git
* [new branch] embrace1.0 -> embrace1.0
Branch embrace1.0 set up to track remote branch embrace1.0 from origin.
localhost:firstDemo mhx$