• gitlab安装随记


    gitlab安装

    配置yum源

    sudo vim /etc/yum.repos.d/gitlab-ce.repo
    

    按照网上别人的例子,修改为清华的源

    [gitlab-ce]
    name=Gitlab CE Repository
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
    gpgcheck=0
    enabled=1
    

    更新yum

    sudo yum makecache
    

    安装GitLab社区版

    安装gitlib-ce

    sudo yum install gitlab-ce
    

    安装完成

    Thank you for installing GitLab!
    GitLab was unable to detect a valid hostname for your instance.
    Please configure a URL for your GitLab instance by setting `external_url`
    configuration in /etc/gitlab/gitlab.rb file.
    Then, you can start your GitLab instance by running the following command:
    sudo gitlab-ctl reconfigure
    
    For a comprehensive list of configuration options please see the Omnibus GitLab readme
    https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
    
    验证中: gitlab-ce-11.9.1-ce.0.el7.x86_64  
    已安装: gitlab-ce.x86_64 0:11.9.1-ce.0.el7    
    

    GitLab常用命令

    sudo gitlab-ctl start    # 启动所有 gitlab 组件;
    sudo gitlab-ctl stop        # 停止所有 gitlab 组件;
    sudo gitlab-ctl restart        # 重启所有 gitlab 组件;
    sudo gitlab-ctl status        # 查看服务状态;
    sudo gitlab-ctl reconfigure        # 启动服务;
    sudo vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;
    gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
    sudo gitlab-ctl tail        # 查看日志;
    

    启动gitlab

    启动gitlab服务

    sudo gitlab-ctl reconfigure
    

    正确配置后,返回信息如下

    Running handlers:
    Running handlers complete
    Chef Client finished, 476/1268 resources updated in 03 minutes 11 seconds
    gitlab Reconfigured!
    

    启动gitlab

    sudo gitlab-ctl start
    

    登录gitlab

    首次登陆时在服务器本地通过浏览器访问localhost,并需要设置root的密码,本次设置为1qaz@WSX。

    修改gitlab配置文件

    gitlab的一些配置文件在/etc/gitlab/gitlab.rb中。配置文件参考: https://docs.gitlab.com.cn/omnibus/

    修改GitLab URL

    修改GitLab URL后可以通过其他客户端浏览器访问

    ## GitLab URL
    ##! URL on which GitLab will be reachable.
    ##! For more details on configuring external_url see:
    ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
    
    external_url 'http://10.23.65.185'
    

    修改后要重启服务等

    sudo gitlab-ctl reconfigure
    sudo gitlab-ctl restart
    
    修改GitLab SMTP

    按照配置文件修改了SMTP并关闭SSL后配置如下

     gitlab_rails['smtp_enable'] = true
     gitlab_rails['smtp_address'] = "mail.xxxx.com"
     gitlab_rails['smtp_port'] = 25
     gitlab_rails['smtp_user_name'] = "abc"
     gitlab_rails['smtp_password'] = "xxxx"
     gitlab_rails['smtp_domain'] = "xxx.com"
     gitlab_rails['smtp_authentication'] = "login"
     gitlab_rails['smtp_enable_starttls_auto'] = false
     gitlab_rails['smtp_tls'] = false
     gitlab_rails['smtp_ssl'] = false
     gitlab_rails['smtp_force_ssl'] = false
     gitlab_rails['smtp_openssl_verify_mode'] = 'none'
    

    执行测试命令gitlab-rails console却报错信息如下:

    Net::SMTPFatalError (553 Mail from must equal authorized user)

    由于一些smtp服务器要求身份验证账号必须与发件人一致,所以修改配置文件并增加最后一行。
    修改后配置如下:

    ### GitLab email server settings
    ###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
    ###! **Use smtp instead of sendmail/postfix.**
    
     gitlab_rails['smtp_enable'] = true
     gitlab_rails['smtp_address'] = "mail.xxxx.com"
     gitlab_rails['smtp_port'] = 25
     gitlab_rails['smtp_user_name'] = "abc"
     gitlab_rails['smtp_password'] = "xxxx"
     gitlab_rails['smtp_domain'] = "xxx.com"
     gitlab_rails['smtp_authentication'] = "login"
     gitlab_rails['smtp_enable_starttls_auto'] = false
     gitlab_rails['smtp_tls'] = false
     gitlab_rails['smtp_ssl'] = false
     gitlab_rails['smtp_force_ssl'] = false
     gitlab_rails['smtp_openssl_verify_mode'] = 'none'
     gitlab_rails['gitlab_email_from'] = "abc@xxxx.com"
    

    使用git命令方式将工程上传到Gitlab

    linux安装git

    sudo yum install git
    

    生成密钥文件等

    windows安装git

    • 下载git的windows版本,然后安装。配置环境变量等。
    • IDEA中配置git
    • Eclipse中配置git(连接gitlab报错,连github可以)

    在windows中生成ssh key,启动git bash

    $ ssh-keygen -t rsa -C g1
    

    生成的路径默认为:

    C:Users当前用户.ssh
    将生成的id_rsa.pub内容复制到Gitlib用户的ssh key中

  • 相关阅读:
    【HDU3032】Nim or not Nim?(博弈论)
    【BZOJ1022】小约翰的游戏(博弈论)
    【HDU1848】Fibonacci again and again(博弈论)
    【POJ1704】Georgia and Bob(博弈论)
    【BZOJ1299】巧克力棒(博弈论,线性基)
    【Luogu2197】NIM游戏(博弈论)
    【洛谷2252&HDU1527】取石子游戏(博弈论)
    【HDU1846】Brave Game(博弈论)
    【CF888G】Xor-MST(最小生成树,Trie树)
    长链剖分学习笔记
  • 原文地址:https://www.cnblogs.com/GYoungBean/p/10640773.html
Copyright © 2020-2023  润新知