配置gitlab網絡版本倉庫及使用


    [root@cnbly_1 ~]# vim /etc/yum.repo.d/gitlab.repo
    輸入如下內容:
    gitlab-ce]
    name=Gitlab CE Repository
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
    gpgcheck=0
    enabled=1

搭建本地git版本倉庫
1、安裝git倉庫
    [root@cnbly_1 ~]# yum -y install  git
2、創建git的用戶名和郵箱地址,(不創建在初始化完git倉庫提交代碼會報錯,提示設置用戶和郵箱)
    [root@cnbly_1 ~]# git config --global user.name "yuefei"
    [root@cnbly_1 ~]# git config --global user.email  [email protected] /mygit
    [root@cnbly_1 ~]# mkdir -p /mygit
    [root@cnbly_1 ~]# cd /mygit/
    [root@cnbly_1 ~]# git init 

    [root@cnbly_1 ~]# echo 'Hello World!' > index.html
    [root@cnbly_1 ~]# git commit -m "mygit version 1"   #說明提交修改的代碼是什麼
    [root@cnbly_1 ~]# git tag 1.0                        #設置版本信息
    [root@cnbly_1 ~]# echo '2nd version' >> index.html
    [root@cnbly_1 ~]# git add .                            #提交代碼
    [root@cnbly_1 ~]# git commit -m "mygit version 2"
    [root@cnbly_1 ~]# git tag 2.0
    [root@cnbly_1 ~]# git tag
    [root@cnbly_1 ~]# ls
    [root@cnbly_1 ~]# cat index.html 
    [root@cnbly_1 ~]# git checkout 1.0
    [root@cnbly_1 ~]# cat index.html 
    [root@cnbly_1 ~]# git checkout master

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章