GitLab版本管理(转)

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

社区版基于MIT license开源彻底免费
无用户,协做和仓库限制
保护你的源码安全
管理仓库,用户与访问权限
更多功能请看这儿mysql

依赖组件:ruby 1.9.3+,MySQL,git,redis, Sidekiq。
最低配置CPU 1G,RAM 1G+swap能够支持100用户。 linux

安装

官方有安装包与脚本下载,官方安装指南。一样GITHUB上有个社区非官方的安装指南git

但这儿里推荐bitnami下载打包安装版本 https://bitnami.com/stack/gitlab/installer ,省去不少时间。他们也提供相关WIKIgithub

ubuntu为演示环境,来安装这个包,切换到root帐户, 在终端运行:web

./bitnami-gitlab-7.1.1-0-linux-x64-installer.runredis

gitlab

出现向导,这个时安装就是傻瓜安装了sql

gitlab2

默认同时安装了GitLab CI, 后然配置Apache的端口,MySQL的端口,注意若是默认端口80, 3306有占用,须要修改。就不截图 了。
这个包默认会安装独立的MySQL,若是须要配置已有Mysql数据库,那么请手工逐个安装各个组件。安装完成后,服务就启动了。shell

配置OS自动启动:数据库

sudo update-rc.d gitlab defaults 21

管理

管理员账号登陆后,有一个管理区,以下图:

gitlabadmin1

在这里能够管理用户,项目,组,日志,消息,Hooks,后台job。 界面清晰,功能明确,在这儿再也不详细描述。

 

使用

1 . 服务端 启动Gitlab

root@ubuntu:/opt/gitlab-7.1.1-0# ./ctlscript.sh start

140818 00:31:57 mysqld_safe Logging to '/opt/gitlab-7.1.1-0/mysql/data/mysqld.log'.

140818 00:31:57 mysqld_safe Starting mysqld.bin daemon with databases from /opt/gitlab-7.1.1-0/mysql/data

/opt/gitlab-7.1.1-0/mysql/scripts/ctl.sh : mysql started at port 3307

/opt/gitlab-7.1.1-0/redis/scripts/ctl.sh : redis started at port 6379

/opt/gitlab-7.1.1-0/apps/gitlab/scripts/sidekiq.sh : gitlab_sidekiq started

Session terminated, terminating shell... ...terminated.

/opt/gitlab-7.1.1-0/apps/gitlabci/scripts/sidekiq.sh : gitlabci_sidekiq started

/opt/gitlab-7.1.1-0/apps/gitlabci/scripts/runner.sh : gitlabci_runner started

Syntax OK

/opt/gitlab-7.1.1-0/apache2/scripts/ctl.sh : httpd started at port 81

:/opt/gitlab-7.1.1-0 是Gitlab的安装目录

也能够查看GUI管理控制台 ./manager-linux-x64.run

clip_image001

上面列出各个组件状态。

2 . 建立与Git项目初始化工做

咱们的Apache webserver 之间安装于81端口,从客户端访问:

http://192.168.169.129:81/

clip_image002

登陆后,可建立三种级别的Projects:

gitlabadmin3

增长项目参加成员:

gitlabadmin4

登陆Gitlab http://10.1.98.251 ,在profile中填写本身ssh-key,

记事本打开C:\Users\Administrator\.ssh \id_rsa.pub内容,copy到下面Key

clip_image002[6]

 

对新建Git项目,初始化,第一个commit:

Git global setup(Git全局设置):

git config --global user.name "testman"
git config --global user.email "testman@hotmail.com"


Create Repository(建立仓库)

mkdir common-util
cd common-util
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@127.0.0.1:devteam/common-util.git
git push -u origin master

对于已存在Git项目:

cd existing_git_repo
git remote add origin git@127.0.0.1:devteam/common-util.git
git push -u origin master

 

进入本地git shell, 生成本身的ssh-key, 联系三个回车

ssh-keygen -t rsa

 

登陆Gitlab,在profile中填写本身ssh-key,

记事本打开C:\Users\Administrator\.ssh \id_rsa.pub内容,copy到下面Key。

clip_image002

 

3. 使用相关用户名登陆,能够看到Dashborad:

clip_image003

显示项目动态:

gitlabadmin2

项目Commit明细:

gitlabadmin5

4. 用Visual Studio 2013作客户端。

因为以前项目已经建好了,Visual Studio 2013里咱们修改文件,点右键来Commit

clip_image004

而后在选择界面中,选择Commit,填写此次提交的信息,也能够Commit and push

clip_image005

提交之后,提示Commit cd900236在本地建立,Sync以共享到服务器

clip_image006

而后Sync, 这里点push 到服务端,第一次会提示您输入密码:

clip_image007

以后结果是: 成功推送1commit到origin/master分支

clip_image008

而后咱们就把代码提交到Gitlab了,打开页面进入相关项目,能够看到刚才commit

clip_image009

GitLab CI

使用gitlab管理员帐户登陆后:

gitlabci

提供了基于持续集成的功能,有于API的访问


上文是基于GitLab 7.1.1版本,因为时间变化,之后可能UI会变化。 又因为篇幅有限,今天简单介绍到这儿。更多能够参考:

GitLab Team blog

MSDN : Using Visual Studio 2013 with Git

您可能感兴趣的文章:

CoinPunk项目介绍

智能移动导游解决方案简介

 

http://www.cnblogs.com/wintersun/p/3930900.html

相关文章
相关标签/搜索