Ubuntu 14.04 LTS 安装Gitlab

            GitLab,是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目安装。 它拥有与GitHub类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。 团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

1.下载gitlab安装包

https://about.gitlab.com/downloads/ 

2.安装依赖

sudo apt-get install wget curl openssh-server ca-certificates postfix

3.安装gitlab安装包

sudo dpkg -i gitlab-ce_7.10.5.deb

wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh

sudo bash script.deb.sh

4.配置 gitlab 

sudo vi /etc/gitlab/gitlab.rb

修改:external_url 'http://192.168.1.30:8090'

5.重启 GitLab

sudo gitlab-ctl reconfigure

6.查看启动状态

sudo gitlab-ctl status

7.打开浏览器登陆 

按照上面设置的external_url访问,第一次登陆默认管理员密码和用户名:

Username:root

Password:5iveL!fe


8.Gitlab 汉化

① 确认本地版本

sudo cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

并确认当前汉化版本的 VERSION 是否相同,当前最新的汉化版本为 8.6 。如果安装版本小于当前汉化版本,请先升级。如果安装版本大于当前汉化版本,请在本项目中提交新的 issue。

② 将 GitLab.com 仓库 git 到本地

git clone https://gitlab.com/larryli/gitlab.git

③ 对比版本生成汉化补丁

git diff origin/8-6-stable..origin/8-6-zh > 8.6.diff

④ 停止 Gitlab

sudo gitlab-ctl stop

⑤ 上传 8.6.diff 文件到服务器

sudo patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 8.6.diff

⑥ 重启 GitLab

sudo gitlab-ctl start


Gitlab和Git的基本使用(客户端管理员创建项目)

1、创建项目

2、添加SSH公钥到Gitlab服务器

ssh-keygen -t rsa -C "setup@192.168.1.71"

cat ~/.ssh/id_rsa.pub

3、Git 全局设置

git config --global user.name "root"
git config --global user.email "admin@example.com"

4、创建新版本库

git clone git@192.168.1.71:root/123.git
cd 123
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

5、已存在的文件夹或 Git 仓库

cd existing_folder
git init
git remote add origin git@192.168.1.71:root/123.git
git add .
git commit
git push -u origin master

6、添加README文件内容

V1.0


项目成员使用

1、克隆管理员建立好的项目:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git clone git@example.com:project-name.git  

2、创建自己的本地分支(分支的命名采用小驼峰式命名法,使用自己的名字+功能,比如zyHighway,不要使用特殊字符):

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git checkout -b $feature_name  
3、写代码,将写好的代码提交到本地分支中:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git commit -am "My feature is ready"  
4、把分支push到Gitlab服务器上:

[plain]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. git push origin $feature_name  
5、在Gitlab的提交页面,查看自己提交的代码;

6、提交一个合并请求;

7、管理员审核代码,决定是否合并代码到主分支上。


参考文章:http://blog.csdn.net/u011241606/article/details/51471367

http://www.tuicool.com/articles/ZR7rmuz


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值