乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Git服務器的搭建全部功略

       xuanji00 2013-09-22

      Git For Windows官網(wǎng) http://code.google.com/p/msysgit/

      tortoisegit官網(wǎng) http://code.google.com/p/tortoisegit/

      copssh用于windows下創(chuàng)建SSH服務器  https://www./i2/copssh

      Putty    http://www./

      Gitolite官方網(wǎng)址:http://github.com/sitaramc/gitolite
      Gitolite在線文檔:http://sitaramc.github.com/gitolite/

      Git官網(wǎng) http:///

      gitweb官網(wǎng)  https://git.wiki./index.php/Gitweb

      學習TortoiseGit教程用這個TortoiseGit日常使用指南.pdf

      Git教程用這個 Git中文教程.pdf

       

      一、準備工作:(服務器端操作)

      sudo apt-get install highlight vim #安裝vim并高亮語法,安裝Gitolite的時候要用到。如果已安裝了此部可省掉。

      二、Ubuntu下安裝SSH Server(服務器端操作)

      ubuntu默認并沒有安裝ssh服務,如果通過ssh鏈接ubuntu,需要自己手動安裝ssh-server。判斷是否安裝ssh服務,可以通過如下命令進行:

      ssh localhost

      安裝命令:

      sudo apt-get install openssh-server

      系統(tǒng)將自動進行安裝,安裝完成以后,先啟動服務:

      sudo /etc/init.d/ssh start 

      啟動后,可以通過如下命令查看服務是否正確啟動

      ps -e|grep ssh 

      重啟sshd的命令

      /etc/rc.d/sshd restart

      二、Linux下SSH使用rsa認證方式省去輸入密碼

      1、使用本地機器生成密鑰(這里使用Git Bash)

      #產(chǎn)生 id_rsa, id_rsa.pub

      ssh-keygen -t rsa –C “kanghui@mtc.com.cn”

      楓@FREEBIRD ~ $ ssh-keygen -t rsa

      Generating public/private rsa key pair.

      Enter file in which to save the key(/c/Users/楓/.ssh/id_rsa):

      Enter passphrase (empty for no passphrase):

      Enter same passphrase again:

      Your identification has been saved in/c/Users/楓/.ssh/id_rsa.

      Your public key has been saved in /c/Users/楓/.ssh/id_rsa.pub.

      The key fingerprint is:

      22:d4:67:ef:65:ba:8e:07:f7:d1:f9:0a:b1:79:4f:8c楓@FREEBIRD

      2、復制生成的id_rsa.pub公鑰文件到遠程服務器上

      # id_rsa.pub 丟到 Server , 大家的 publickey 都需要傳到 Server .

      scp ~/.ssh/id_rsa.pub roan@192.168.35.10:/home/roan/.ssh/authorized_keys

      再復制一份到服務器的/temp文件夾下面一會gitolite要用

      scp ~/.ssh/id_rsa.pub roan@192.168.35.10:/tmp/MTC.pub#注意MTC.pub在gitolite里面就是你的用戶名

       

      還有一個命令簡體了命令操作(ssh-copy-id),和上面的操作是一樣的。

      ssh-copy-id 把本地主機的公鑰復制到遠程主機的authorized_keys文件上。

      ssh-copy-id 也會給遠程主機的用戶主目錄(home)和~/.ssh, 和~/.ssh/authorized_keys設置合適的權(quán)限 。

      ssh-copy-id-i ~/.ssh/id_rsa.pub roan@192.168.35.10

      [注: ssh-copy-id 把密鑰追加到遠程主機的.ssh/authorized_key 上.]

      3、將私鑰id_rsa生成Putty格式

      putty作為遠程客戶端在putty不能識別直接從服務器拷貝來的私鑰,需要使用puttygen.exe進行格式轉(zhuǎn)換

      (1)、打開puttygen.exe--> Conversions --> Import Key

      (2)、選擇拷貝過來的私鑰文件id_rsa

      (3)、Save privatekey->id_rsa.ppk(保存私鑰)

      4、打開putty.exe

      1)、Session --> HostName (填寫服務器地址或者域名)

      2)、Connection -->SSH --> Auth (點Browse選擇剛生成的id_rsa.ppk)

      3)、open

      成功打開后出現(xiàn)如下提示:

      login as: root

      Authenticating with public key"imported-openssh-key"

      ----------------------------------------------------------------------------------

      當然你有可能會遇到這個錯誤 [因為我遇到了,呵呵]:

      Permissions 0755 for '你配置的公鑰文件路徑'are too open.

      這個是因為這幾個文件權(quán)限設置的有點問題

      執(zhí)行命令: chmod 600 /root/.ssh/authorized_keys

      三、Linux 使用 Gitolite 架設 Git Server

      想要控管 User / Project 權(quán)限, 而且還想要控管 branch / tag 等讀寫權(quán)限, 則需要靠 Gitolite 等套件來協(xié)助.

        gitolite - SSH-basedgatekeeper for git repositories

      相關(guān)資料準備

        系統(tǒng): Ubuntu Linux

        Server: 192.168.35.10

        Project name:project_name

        Gitosis (Git)Repository 位置/home/git/repositories

        Group name: git

      系統(tǒng)套件安裝

        sudo apt-get install gitolite git-core   

      • 安裝完成會出現(xiàn)此訊息: No adminkey given - not setting up gitolite.

      創(chuàng)建服務器上的Git賬號 #創(chuàng)建的git賬號是不能直接登錄使用的只能通過命令sudosu – git來操作。

      roan@ubuntu:~$ sudo adduser --system --shell /bin/bash --gecos'git version control' --group --disabled-password --home /home/git git

      [sudo] password for roan:

      正在添加系統(tǒng)用戶"git" (UID 116)...

      正在添加新組"git" (GID 125)...

      正在將新用戶"git" (UID 116)添加到組"git"...

      創(chuàng)建主目錄"/home/git"...

      Gitolite Server 架設

      1.       ssh roan@192.168.35.10 # 登錄到Git Server

      2.      sudo su – git  #切換到git賬號

      3.      gl-setup /tmp/MTC.pub # 加入管理者的 Public key(公鑰). 注意: 檔名即是賬號名稱, 不要使用 id_rsa.pub 當檔名, 建議 "賬號.pub" 當檔名

      命令過程如下   #按大寫ZZ兩次退出Vim-tiny #q!可以退出vimwq保存并退出vim

       git@ubuntu:~$ gl-setup /tmp/MTC.pub

      The default settings in the rcfile (/home/git/.gitolite.rc) are fine for most

      people but if you wish to makeany changes, you can do so now.

      hit enter...

      Select an editor.  To change later, run 'select-editor'.

        1. /bin/ed

        2. /bin/nano        <---- easiest

        3. /usr/bin/vim.basic

        4. /usr/bin/vim.tiny

      Choose 1-4 [2]: 3

      此時要特別注意如果要用Gitweb的話一定要

      $REPO_UMASK =0077; 改成 $REPO_UMASK = 0027; # gets you 'rwxr-x---'。

      creating gitolite-admin...

      Initialized empty Gitrepository in /home/git/repositories/gitolite-admin.git/

      creating testing...

      Initialized empty Gitrepository in /home/git/repositories/testing.git/

      [master (root-commit) f489c2a]start

       2 files changed, 6 insertions(+)

       create mode 100644 conf/gitolite.conf

       create mode 100644 keydir/mtc.pub

      4.      exit

      Gitolite Server 設定專案、新增賬號(客戶端操作)

      1.       Gitolite 的專案權(quán)限 / 賬號管理是使用 Git 來管理, 專案名稱: gitolite-admin.git

      2.      git clone git@192.168.35.10:gitolite-admin # 因為 Gitolite 是用 gitolite-admin.git 來管理, 所以需要抓下來修改、設定(未來所有管理也是如此)

      3.      cdgitolite-admin # 會看到下述

        conf/gitolite.conf# 設定檔, 設定誰可以讀寫哪個專案的 Repository

        keydir # 目錄, 放每個賬號的 public key. 放置的檔案命名: user1.pub, user2.pub(user1, user2.. 為賬號名稱(檔名 = 賬號), 建議使用 "賬號.pub" 當檔名)

      設定專案權(quán)限(客戶端操作)

      1.       cdgitolite-admin

      2.      vimconf/gitolite.conf # 會看到下述, 不要動他, 于最下方設定自己的 Group / 專案名稱即可.

      repo   gitolite-admin
      RW+     =   admin
      repo    testing
      RW+     =   @all

      3.      由此檔案新增 / 修改后, commit + push 即可.

      建立專案

      1.       git clonegitolite@example.com:testing # 對應 gitolite.conf repo testing, 會出現(xiàn)下述訊息

      Cloning intotesting...
      warning: You appear to have cloned an empty repository.

      2.      cd testing

      3.      touch readme

      4.      git add .

      5.       git commit -m'add readme'

      6.      git push originmaster

      新增賬號

      1.       cd gitolite-admin

      2.      cp/tmp/user1.pub keydir/user1.pub # 請依照實際賬號命名, 不要取 user1, user2

      3.      cp/tmp/user1.pub keydir/user1@machine.pub # 若相同賬號, 則使用 user@machine.pub

      4.      cp/tmp/user2.pub keydir/user2.pub

      5.       git addkeydir/user1.pub keydir/user1@machine.pub keydir/user2.pub

      6.      git commit -m'add user1, user1@machine, user2 public key'

      7.       git push

      gitolite.conf 更多設定條件

      下述摘錄自Gitolite 構(gòu)建 Git 服務器 - 授權(quán)使用者建立屬于自己的空間 (User 下面可以建 N Repository), 在此就不記載, 請自行詳見: 此文的章節(jié) 2.4.3

      #取自 2.3.1 授權(quán)文件基本語法
      @admin = jiangxin wangsheng

      repogitolite-admin
      RW+    = jiangxin

      repoossxp/.+
      C       = @admin
      RW     = @all

      repotesting
      RW+                  =   @admin
      RW     master        =   junio
      RW+     pu           =   junio
      RW     cogito$        =   pasky
      RW     bw/           =  linus
      -                       =   somebody
      RW     tmp/           =  @all
      RW      refs/tags/v[0-9] =   junio

      #取自 2.3.3 ACL
      repo testing
      RW+   = jiangxin @admin
      RW    = @dev @test
      R      = @all

      gitolite.conf 語法說明

      repo 語法

        repo 語法<權(quán)限> [零個或多個正規(guī)表示式批配的引用] = <user> [<user>...]

        每條指令必須指定一個權(quán)限, 權(quán)限可以用下面任何一個權(quán)限的關(guān)鍵字: C, R, RW, RW+, RWC, RW+C, RWD, RW+D, RWCD,RW+CD

        C : 建立

        R : 讀取

        RW : 讀取 + 寫入

        RW+ : 讀取 + 寫入 + rewind commit 做強制 Push

        RWC : 授權(quán)指令定義 regex (regex 定義的 branchtag ), 才可以使用此授權(quán)指令.

        RW+C : 同上, C 是允許建立 regex 配對的引用 (branch、tag )

        RWD : 授權(quán)指令中定義 regex (regex 定義的 branch、tag ), 才可以使用此授權(quán)指令.

        RW+D : 同上, D 是允許刪除 regex 配對的引用 (branch、tag )

        RWCD : 授權(quán)指令中定義 regex (regex 定義的 branch、tag ), 才可以使用此授權(quán)指令.

        RW+CD : C 是允許建立 regex 配對的引用 (branchtag ), D 是允許刪除 regex 配對的引用 (branch、tag )

        - : 此設定為不能寫入, 但是可以讀取

        : regex 不是以 refs/ 開頭, 會自動于前面加上 refs/heads/

      群組

        @all 代表所有人的意思

        @myteam user1user2 : user1, user2 都是屬于 myteam 這個群組

      • #testing "owner name" = "one line of description"
      • testing "admin" = "adadfsaf one line of description"

      常用命令

      下述全部都在 gitolite-admin.git 內(nèi)操作

        新增賬號

        cp/tmp/user1.pub keydir/user1.pub # 注意檔名要取 "賬號.pub"

        新增專案

      1.       vimconf/gitolite.conf # 增加 repo, 例如:

      repo testing
      RW @all

      2.           git clone gitolite@example.com:testing

        設定專案

        vimconf/gitolite.conf # 增加 repo, 設定讀寫群組、使用者的權(quán)限

      擴展命令1,用于本地已建好的repo關(guān)鏈到遠程服務器

      1.       cd ~/

      2.      mkdir DVBT-TEST

      3.      cd DVBT-TEST

      4.      git init

      5.       git remote add origin git@192.168.35.10:DVBT-TEST.git

       # gitosis 會自行于/srv/gitosis/repositories 新增

      6.      touch readme

      7.       git add .

      8.      git commit -m'initial'

      9.      git push originmaster:refs/heads/master # git push origin master

       

      擴展命令2,用于查看遠程服務器數(shù)據(jù)庫

      $ ssh git@192.168.35.10

      hello mtc, this is gitolite 2.3-1 (Debian) running ongit 1.7.10.4

      the gitolite config gives you the followingaccess:

          R   W      DVBT-TEST

          R   W      gitolite-admin

         @R_ @W_     testing

      Connection to 192.168.35.10 closed.

      用Gitweb以HTTP方式查看Git代碼倉

      Gitweb是用來在網(wǎng)頁上查看GIT代碼庫的。沒有Gitweb,我們?nèi)匀豢梢允褂肎it客戶端從Gitolite服務器上獲取代碼。Gitweb演示:http://git./

      安裝GitWeb

      第一步: 安裝gitwebhighlight,Gitweb安裝在/usr/share/gitweb #這里就是你看到的網(wǎng)頁地方的代碼

      $ sudo apt-get installhighlight gitweb       #自動會安裝apache2

      第二步:修改gitweb.conf

      $ sudo vim /etc/gitweb.conf

      #change $projectroot to /home/git/repositories

      #change $projects_list to /home/git/projects.list

      # AddHighlighting at the end #在網(wǎng)頁中查看代碼的時候可以高亮語法

      $feature{'highlight'}{'default'}= [1];

      第三步:修改git倉庫文件夾的權(quán)限

      Changegitolite instance to allow access for gitweb. First append www-data to gitgroup so gitweb can access the repos, then change the permissions for git reposand the projects list, finally restart apache:

      sudo usermod -a -G git www-data

      sudo chmod g+r/home/git/projects.list

      sudo chmod -R g+rx /home/git/repositories

      sudo service apache2 restart或者sudo /etc/init.d/apache2 restart #效查一樣都是重啟apache

      第四步:Finallyyou need to tell gitolite which repo you want to show up in gitweb. To do thisedit the gitolite.conf file from the gitolite-admin.git repo:

       

      repotesting

        RW+ = @all

        R = gitweb

      補充:

      the best solution I found for this was to edit the .gitolite.rc file andto change the umask.

      1.   the default umask for repositories is0077; change this if you run stuff

      2.   like gitweb and find it can't read therepos. Please note the syntax; the

      3.   leading 0 is required

      #$REPO_UMASK = 0077; # gets you 'rwx------'
      #$REPO_UMASK = 0027; # gets you 'rwxr-x---'
      $REPO_UMASK = 0022; # gets you 'rwxr-xr-x'

       

      Gitweb自定義內(nèi)容如下:

      # useradd start

      $feature{'highlight'}{'default'}= [1];

      $feature{'highlight'}{'override'}= 1;

      $feature{'blame'}{'default'}= [1];

      $feature{'blame'}{'override'}= 1;

      $feature{'pickaxe'}{'default'}= [1];

      $feature{'pickaxe'}{'override'}= 1;

      $feature{'search'}{'default'}= [1];

      $feature{'search'}{'override'}= 1;

      $feature{'grep'}{'default'}= [1];

      $feature{'grep'}{'override'}= 1;

      $feature{'snapshot'}{'default'}= ['tgz', 'tbz2', 'zip'];

      $feature{'snapshot'}{'override'}= 1;

      $feature{'avatar'}{'default'}= ['gravatar'];

      $feature{'avatar'}{'override'}= 1;

      #$fallback_encoding= 'utf-8';

      $fallback_encoding= 'EUC-CN';

      #$projects_list_description_width = 50;

      $site_name= "MTC git Server";

      # Title

      $home_link_str= 'MTC Projects';

       

      Gitweb主題(只是讓Gitweb更好看一些,可選擇安裝)

      https://github.com/kogakure/gitweb-theme                                                                           

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多