<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # gitlab部署和使用 [TOC] ## 一、部署 ### 1. 簡介 gitLab 是一個用于倉庫管理系統的開源項目。使用Git作為代碼管理工具,并在此基礎上搭建起來的web服務。可通過Web界面進行訪問公開的或者私人項目。 它擁有與Github類似的功能,能夠瀏覽源代碼,管理缺陷和注釋。可以管理團隊對倉庫的訪問,它非常易于瀏覽提交過的版本并提供一個文件歷史庫。 團隊成員可以利用內置的簡單聊天程序(Wall)進行交流。它還提供一個代碼片段收集功能可以輕松實現代碼復用。 ### 2. 安裝 由于gitlab自帶服務較多,因此建議使用全新服務器進行安裝,生產環境內存4G起 1) 站點 官網: https://about.gitlab.com/ 國內鏡像站:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum 2) 安裝依賴和軟件 安裝依賴 ```sh yum install curl policycoreutils openssh-server openssh-clients policycoreutils-python ``` 上傳gitlab壓縮包并用rpm安裝 ```sh ls /server/tools/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm /server/tools/gitlab-ce-10.2.2-ce.0.el7.x86_64.rpm rpm -ivh gitlab-ce-10.7.0-ce.0.el7.x86_64.rpm ``` 3) 修改配置文件 修改配置文件中的url部分,使用本機IP地址.命令和結果如下 ```sh sed -i '/^external_url/ s#http.*com#http://10.0.0.131#g' /etc/gitlab/gitlab.rb cat /etc/gitlab/gitlab.rb|grep "^external_url" external_url 'http://10.0.0.13' ``` 4) 初始化 ```sh gitlab-ctl reconfigure gitlab-ctl start ``` > 每次修改了配置文件后,都要用gitlab-ctl reconfigure命令激活配置 > 初始化完成后,可以通過瀏覽器進行訪問了,默認是80端口 > > ### 3. gitlab常用命令 ```sh gitlab-ctl start 啟動全部服務 gitlab-ctl restart 重啟全部服務 gitlab-ctl stop 停止全部服務 gitlab-ctl reconfigure 使配置文件生效 gitlab-ctl show-config 驗證配置文件 gitlab-ctl uninstall 刪除gitlab(保留數據) gitlab-ctl cleanse 刪除所有數據,從新開始 gitlab-ctl tail <service name> 查看服務的日志 ``` ## 二、gitlab基礎操作 ### 1. 基礎配置 1) 取消自動注冊功能 在管理員配置中,點擊最下面的settings,然后找到圖上所指位置,取消掉自動注冊功能 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200308/183927200.png) 2) 添加ssh-key 當需要gitlab和其他服務器做免秘鑰認證的時候,就需要在gitlab中添加ssh私鑰 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200308/183936827.png) 3) 創建group 略 4) 創建用戶 略 5) 用戶授權 略 ### 2. 創建項目 1) 創建空項目 在首頁點擊創建項目,輸入如下信息創建一個項目 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200308/183950444.png) 2) 導入公有庫項目 ![mark](http://noah-pic.oss-cn-chengdu.aliyuncs.com/pic/20200308/183959603.png) 3) 與git聯動 項目創建好以后,會提示你git命令行操作方式,如下 Command line instructions ```sh Git global setup git config --global user.name "Administrator" git config --global user.email "admin@example.com" ``` Create a new repository ```sh git clone git@10.0.0.13:root/test-job.git cd test-job touch README.md git add README.md git commit -m "add README" git push -u origin master ``` Existing folder ```sh cd existing_folder git init git remote add origin git@10.0.0.13:root/test-job.git git add . git commit -m "Initial commit" git push -u origin master ``` Existing Git repository ```sh cd existing_repo git remote rename origin old-origin git remote add origin git@10.0.0.13:root/test-job.git git push -u origin --all git push -u origin --tags ``` ## 三、目錄和備份 ### 1. 目錄 ```sh /var/opt/gitlab/git-data/repositories: 庫默認存儲目錄 /opt/gitlab: 應用代碼和相應的依賴程序 /var/opt/gitlab: reconfigure命令編譯后的應用數據和配置文件,不需要人為修改 /etc/gitlab: 配置文件目錄 /var/log/gitlab: 此目錄下存放了gitlab各個組件產生的日志 /var/opt/gitlab/backups/: 備份文件生成的目錄 ``` ### 2. 配置變更 1. 修改配置文件 2. `gitlab-ctl reconfigure` 重置配置文件 3. `gitlab-ctl show-config` 驗證配置文件 4. `gitlab-ctl restart` 重啟gitlab服務 ### 3. gitlab備份管理 1) 在配置文件中加入如下內容 ```sh cat >>/etc/gitlab/gitlab.rb <<'EOF' gitlab_rails['backup_path'] = '/data/backup/gitlab' gitlab_rails['backup_keep_time'] = 604800 EOF ``` 2) 如果自定義備份目錄需要賦予git權限 ```sh mkdir /data/backup/gitlab chown -R git.git /data/backup/gitlab /usr/bin/gitlab-rake gitlab:backup:create #執行備份 ``` 3) 定時任務Crontab中加入 ```sh 0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create ``` ### 4. GITLAB數據恢復 如果要恢復gitlab數據庫,需要先停止數據寫入服務,在進行恢復操作 ```sh gitlab-ctl stop unicorn gitlab-ctl stop sidekiq gitlab-rake gitlab:backup:restore BACKUP=1512811475_2017_12_09_10.2.2 gitlab-ctl restart ``` 注意:要恢復的文件,存放在前面定義的備份目錄中,但恢復時不需要寫全路徑,也不需要寫全名,只需要向上面一樣寫出備份日期的相關特征即可
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看