CentOS 6.7 Git 服務搭建及TortoiseGit配置串連

來源:互聯網
上載者:User

標籤:centos+tortoisegit+gitolite


    咳咳~好幾天沒寫博文啦,這幾天都在研究Git,沒辦法公司要要拋棄SVN轉站Git,廢話就不多說,下面我們進行操作示範:


環境:之前搭建的Redis-Master伺服器一枚,配置一般般~

工具:TortoiseGit,傳說中的小烏龜~


1、安裝開發工具與依賴包

[[email protected]_master ~]# yum groupinstall "Development tools"            \\安裝下開發工具,也不是一定要裝,只不過自己習慣裝起來===============\\安裝依賴包=====================[[email protected]_master ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel

2、安裝Git

[[email protected]_master ~]# yum install git

3、建立Git使用者

[[email protected]_master ~]# useradd git\\切換到git,並且確保所在位置與使用者名稱[[email protected]_master ~]# su - git[[email protected]_master ~]$ pwd/home/git[[email protected]_master ~]$ whoami git\\查看.ssh是否存在,如果不存在請自行建立[[email protected]_master ~]$ ls -a.  ..  .bash_history  .bash_logout  .bash_profile  .bashrc  gitolite.tar.gz  .ssh  .viminfo

4、擷取Git版本安裝

[[email protected]_master ~]$ git clone [[email protected]_master ~]$ lsgitolite.tar.gz                \\由於下載速度實在慢,本人使用了線上伺服器download並打包傳到自己的實驗小雞上面 [[email protected]_master ~]$ tar xf gitolite.tar.gz     \\解壓縮[[email protected]_master ~]$ lsgitolite  gitolite.tar.gz=========建立使用者家目錄及安裝gitolite[[email protected]_master ~]$ mkdir $HOME/bin[[email protected]_master ~]$ $HOME/gitolite/install -to $HOME/bin[[email protected]_master ~]$ ls . bin/.:bin  gitolite  gitolite.tar.gzbin/:commands  gitolite  gitolite-shell  lib  syntactic-sugar  triggers  VERSION  VREF

5、配置Gitolite管理員

[[email protected]_master ~]$ ssh-keygen -t rsa  \\這條為ssh密鑰產生命令,我這邊已經有了就直接使用了[[email protected]_master ~]$ /home/git/bin/gitolite setup -pk .ssh/id_rsa.pub    \\使用管理員公開金鑰安裝GitoliteInitialized empty Git repository in /home/git/repositories/gitolite-admin.git/Initialized empty Git repository in /home/git/repositories/testing.git/

6、產生管理員倉庫gitolite-admin

[[email protected]_master ~]$ git clone [email protected]:gitolite-adminInitialized empty Git repository in /home/git/gitolite-admin/.git/The authenticity of host ‘127.0.0.1 (127.0.0.1)‘ can‘t be established.RSA key fingerprint is 64:df:86:6c:e3:96:c3:52:80:a7:d8:af:27:4a:4c:80.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added ‘127.0.0.1‘ (RSA) to the list of known hosts.remote: Counting objects: 6, done.remote: Compressing objects: 100% (4/4), done.remote: Total 6 (delta 0), reused 0 (delta 0)Receiving objects: 100% (6/6), done.[[email protected]_master ~]$ lsbin  gitolite  gitolite-admin  gitolite.tar.gz  projects.list  repositories

7、瞭解gitolite-admin倉庫配置及TortoiseGit安裝及秘鑰產生

[[email protected]_master ~]$ cd gitolite-admin/[[email protected]_master gitolite-admin]$ ls conf/ keydir/ .git/conf/:gitolite.conf.git/:branches  config  description  HEAD  hooks  index  info  logs  objects  packed-refs  refskeydir/:id_rsa.pub


 7.1 .git檔案目錄為git程式自動產生

 7.2 conf名字上就知道是設定檔

 7.3 keydir名字上也可以看出是存放key的檔案目錄

 7.4 TortoiseGit安裝及秘鑰產生

 

7.2====================修改前============================[[email protected]_master gitolite-admin]$ cat conf/gitolite.conf repo gitolite-admin            \\這裡就是定義我們之前第6點講到的產生管理員倉庫    RW+     =   id_rsa        \\該id_rsa是我們之前安裝用到的id_rsa.pub也是我們用來管控的帳號,給名字可以重取,比如按照編號之類的repo testing                   \\testing為project,系統自動會建立的一個測試的倉庫    RW+     =   @all           \\該@all用過svn的知道,這是一個輸出組=====================修改後==============================[[email protected]_master gitolite-admin]$ vim conf/gitolite.conf #############=====Groups======##################   @dev_rw = sunshine         \\我新增的使用者sunshinerepo gitolite-admin    RW+     =   id_rsarepo testing    RW+     =   @allrepo dev    RW+     =   @dev_rw        \\新增的輸出組
7.3====================修改前============================[[email protected]_master gitolite-admin]$ ls keydir/id_rsa.pub                \\改名字我們可以自訂,在conf配置的使用者就是去掉pub後的名稱=====================修改後==============================[[email protected]_master gitolite-admin]$ ls keydir/id_rsa.pub  sunshine.pub   \\該秘鑰使用TortoiseGit中的PuTTYgen產生,下面會介紹


 7.4 TortoiseGit的安裝及秘鑰產生

進入https://tortoisegit.org/download/官網下載對應版本

安裝,就是下一步下一步。


7.4.1 使用PuTTYgen產生秘鑰,點擊Genetate

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/88/5F/wKiom1fzKETz9U32AABQDMyTeh0120.png-wh_500x0-wm_3-wmp_4-s_4202587557.png" title="1.png" alt="wKiom1fzKETz9U32AABQDMyTeh0120.png-wh_50" />

7.4.2 滑鼠記得要在Please 下面的框框移來移去,不然你就等很久才能產生完畢,這類似我們產生Linux ssh產生敲打鍵盤一樣

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/88/5F/wKiom1fzKWLCmGvKAABnz2KXd4c774.png-wh_500x0-wm_3-wmp_4-s_2288467792.png" title="2.png" alt="wKiom1fzKWLCmGvKAABnz2KXd4c774.png-wh_50" />



7.4.3 

 1、在key comment後面輸入 sunshine 

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/88/5B/wKioL1fzKfKwY7wSAACS_KUtsi8662.png-wh_500x0-wm_3-wmp_4-s_2482438759.png" title="3.png" alt="wKioL1fzKfKwY7wSAACS_KUtsi8662.png-wh_50" />

 2、把public框框下面的公開金鑰複製到我們之前在keydir目錄下的sunshine.pub裡面

[[email protected]_master gitolite-admin]$ cat keydir/sunshine.pub ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAgKGrcRSPcJE0o37svz0DqncT0cTyI9oGv8mmI9z00wSMumAq82gFdHC0xpVeFcdZQfNM7bsZlxGskEF7/W7p6P4Dc0RCiArcYaSWd0sj1+16ZQADARjFVzf5OBzQNy6OSbAKub/LS1fnl4W7Ad1Mq7wCAVpXzPWVINB3gbzecFekUJ42quqXju+/MtVIfipmEvsJnsOtCfUg5sHUFL7d0dBNgYhXoFPtpuFKS7ay/1dE9JPu83jUB+WkjW/VRIIMrXpAhHVfZ0W25B4cVS04TeNZuLlxAa4HdsI/CbEckzxYvdFDgTPhTqiVTMOFJwhzzUFCxGNlge4vfh1sZP14Ew== sunshine

 

 3、點擊Save private key 儲存到我們指定的目錄

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M02/88/5B/wKioL1fzKfKwY7wSAACS_KUtsi8662.png-wh_500x0-wm_3-wmp_4-s_2482438759.png" title="3.png" alt="wKioL1fzKfKwY7wSAACS_KUtsi8662.png-wh_50" />



7.5 在服務端執行如下命令

[[email protected]_master gitolite-admin]$ git add conf/gitolite.conf              \\將gitolite.conf添加到暫存區[[email protected]_master gitolite-admin]$ git add keydir                           \\將keydir添加到暫存區[[email protected]_master gitolite-admin]$ git commit -m " New add sunshine.pub key and conf/gitolite.conf "    \\提交並說明內容[master 9d8a7e7]  New add sunshine.pub key and conf/gitolite.conf Committer: git <[email protected]_master.(none)>Your name and email address were configured automatically basedon your username and hostname. Please check that they are accurate.You can suppress this message by setting them explicitly:    git config --global user.name "Your Name"                               \\初次提價交要求填寫相應使用者名稱    git config --global user.email [email protected]                           \\初次提交會要求填寫Email地址If the identity used for this commit is wrong, you can fix it with:    git commit --amend --author=‘Your Name <[email protected]>‘ 2 files changed, 8 insertions(+), 0 deletions(-) create mode 100644 keydir/sunshine.pub[[email protected]_master gitolite-admin]$ git config --global user.email "[email protected]"        \\全域填寫使用者名稱[[email protected]_master gitolite-admin]$ git config --global user.name "sunshineboysfz"                    \\全域填寫Email地址[[email protected]_master gitolite-admin]$ git push                                                           \\同步到gitolite中的master去Counting objects: 10, done.Delta compression using up to 4 threads.Compressing objects: 100% (5/5), done.Writing objects: 100% (6/6), 872 bytes, done.Total 6 (delta 0), reused 0 (delta 0)remote: Initialized empty Git repository in /home/git/repositories/dev.git/To [email protected]:gitolite-admin   2de3dc5..9d8a7e7  master -> master


7.6 TortoiseGit串連配置

  1、在windows目錄(自己指定的地方)建立一個目錄

  2、郵件該檔案,點擊Git複製

  3、填寫相應的資訊,並且在載入PuTTY秘鑰載入7.4.3的第三點,就是自己保持的私密金鑰檔案。最後點擊確定

650) this.width=650;" src="http://s2.51cto.com/wyfs02/M01/88/5F/wKiom1fzLZjQFddqAABpt0QlKB0288.png-wh_500x0-wm_3-wmp_4-s_2164226486.png" title="4.png" alt="wKiom1fzLZjQFddqAABpt0QlKB0288.png-wh_50" />

650) this.width=650;" src="http://s4.51cto.com/wyfs02/M00/88/5B/wKioL1fzLkuB_PR3AABm9vd_rco822.png-wh_500x0-wm_3-wmp_4-s_22675114.png" style="float:none;" title="4.png" alt="wKioL1fzLkuB_PR3AABm9vd_rco822.png-wh_50" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/88/5B/wKioL1fzMETDByPsAADKhNVMrAs360.png-wh_500x0-wm_3-wmp_4-s_2606494923.png" title="6.png" alt="wKioL1fzMETDByPsAADKhNVMrAs360.png-wh_50" />

至此,CentOS+TortoiseGit+gitolite就搭建好啦,其實服務搭建看看就會,主要是使用。



本文出自 “SunshineBoySZF” 部落格,請務必保留此出處http://sunshineboyszf.blog.51cto.com/12087328/1858685

CentOS 6.7 Git 服務搭建及TortoiseGit配置串連

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.