zoukankan      html  css  js  c++  java
  • GitLab版本管理

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

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

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

    安装

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

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

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

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

    gitlab

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

    gitlab2

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

    配置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:UsersAdministrator.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:UsersAdministrator.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

  • 相关阅读:
    HDU-5514 Frogs 容斥
    2019ICPC EC-FINAL H-King 随机
    2019ICPC EC-FINAL E-Flow 贪心
    洛谷P4200 千山鸟飞绝 Splay
    CodeForces 1249F Maximum Weight Subset 树形dp
    HDU-5534 Partial Tree 完全背包优化
    【数论】Lucas定理
    [APIO2009]抢掠计划 解题报告
    tarjan(缩点)
    树状数组总结
  • 原文地址:https://www.cnblogs.com/chen110xi/p/4798591.html
Copyright © 2011-2022 走看看