1.下载地址

http://www.gitblit.com/

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

2.安装jdk(自行安装)

3.解压gitblit

# tar -zxvf gitblit-1.8.0.tar.gz

4.配置
# cd gitblit-1.8.0/data

# vi gitblit.properties

添加以下信息:

# SINCE 1.7.0
include = defaults.properties
server.httpPort=81
server.httpBindInterface=192.168.28.130
server.httpsBindInterface=localhost

5.启动和停止

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

gitblit安装使用 随笔 第1张

7.创建用户

gitblit安装使用 随笔 第2张

gitblit安装使用 随笔 第3张

gitblit安装使用 随笔 第4张

gitblit安装使用 随笔 第5张

8.创建团队

gitblit安装使用 随笔 第6张

9.创建版本库

gitblit安装使用 随笔 第7张

gitblit安装使用 随笔 第8张

10.分配项目给其他人员

先分配给组,再分配给组中的成员

 gitblit安装使用 随笔 第9张

 

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$

gitblit安装使用 随笔 第10张

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$ 

 gitblit安装使用 随笔 第11张

gitblit安装使用 随笔 第12张

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄