CentOS 6.5 + Git 1.8.3.1 + Gitosis build Git Server

Source: Internet
Author: User
Tags git client

Environment:

Git Sserver

IP: 192.168.40.128

Git Client

IP: 192.168.40.134

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

Recommended reading:

Fedora downloads Git through Http Proxy

Install Git on Ubuntu Server

Create a Git repository on the server (Ubuntu)

Git simple tutorial in Linux (taking Android as an example)

Git authoritative guide PDF

_ -- Configure the Git environment on Git Sserver

1) dependent packages required for Software Installation

[Root @ Git ~] # Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel python-setuptools-y

2) install git

[Root @ Git ~] # Mkdir/tmp/soft/

[Root @ Git ~] # Cd/tmp/soft/

[Root @ Git soft] # tar zfvx git-1.8.3.1-linux-1374045102000.tar.gz

[Root @ Git git-1.8.3.1] # make prefix =/usr/local/git all

[Root @ Git git-1.8.3.1] # make prefix =/usr/local/git install

[Root @ Git git-1.8.3.1] # ln-s/usr/local/git/bin/*/usr/bin/

[Root @ Git git-1.8.3.1] # git -- version

Git version 1.8.3.1 # indicates that the installation is successful.


3) install gitosis

[Root @ Git git-1.8.3.1] # cd/usr/local/

[Root @ Git local] # it clone git: // github.com/res0nat0r/gitosis.git

-Bash: it: command not found

[Root @ Git local] # git clone git: // github.com/res0nat0r/gitosis.git

Cloning to 'gitoss '...

Remote: Reusing existing pack: 727, done.

Remote: Total 727 (delta 0), reused 0 (delta 0)

Receiving objects: 100% (727/727), 179.60 KiB | 104.00 KiB/s, done.

Processing delta: 100% (407/407), done.

[Root @ Git local] # cd gitosis

[Root @ Git gitosis] # python setup. py install

Running install

Running bdist_egg

Running egg_info

Creating gitosis. egg-info

Writing requirements to gitosis. egg-info/requires.txt

Writing gitosis. egg-info/PKG-INFO

Writing top-level names to gitosis. egg-info/top_level.txt

Writing dependency_links to gitosis. egg-info/dependency_links.txt

Writing entry points to gitosis. egg-info/entry_points.txt

Writing manifest file 'gitosis. egg-info/SOURCES.txt'

Reading manifest file 'gitosis. egg-info/SOURCES.txt'

Reading manifest template 'manifest. in'

Writing manifest file 'gitosis. egg-info/SOURCES.txt'

Installing library code to build/bdist. linux-x86_64/egg

Running install_lib

Running build_py

Creating build

Creating build/lib

Creating build/lib/gitosis

Copying gitosis/gitweb. py-> build/lib/gitosis

Copying gitosis/gitdaemon. py-> build/lib/gitosis

Copying gitosis/init. py-> build/lib/gitosis

Copying gitosis/run_hook.py-> build/lib/gitosis

Copying gitosis/access. py-> build/lib/gitosis

Copying gitosis/snagit. py-> build/lib/gitosis

Copying gitosis/util. py-> build/lib/gitosis

Copying gitosis/ssh. py-> build/lib/gitosis

Copying gitosis/repository. py-> build/lib/gitosis

Copying gitosis/group. py-> build/lib/gitosis

Copying gitosis/app. py-> build/lib/gitosis

Copying gitosis/_ init _. py-> build/lib/gitosis

Copying gitosis/serve. py-> build/lib/gitosis

Copying gitosis/mirror. py-> build/lib/gitosis

Creating build/lib/gitosis/test

Copying gitosis/test/test_repository.py-> build/lib/gitosis/test

Copying gitosis/test/test_init.py-> build/lib/gitosis/test

Copying gitosis/test/util. py-> build/lib/gitosis/test

Copying gitosis/test/test_access.py-> build/lib/gitosis/test

Copying gitosis/test/test_group.py-> build/lib/gitosis/test

Copying gitosis/test/test_assist.py-> build/lib/gitosis/test

Copying gitosis/test/test_run_hook.py-> build/lib/gitosis/test

Copying gitosis/test/test_serve.py-> build/lib/gitosis/test

Copying gitosis/test/test_ssh.py-> build/lib/gitosis/test

Copying gitosis/test/_ init _. py-> build/lib/gitosis/test

Copying gitosis/test/test_gitweb.py-> build/lib/gitosis/test

Copying gitosis/test/test_gitdaemon.py-> build/lib/gitosis/test

Creating build/lib/gitosis/templates

Copying gitosis/templates/_ init _. py-> build/lib/gitosis/templates

Creating build/lib/gitosis/templates/admin

Creating build/lib/gitosis/templates/admin/hooks

Copying gitosis/templates/admin/hooks/post-update-> build/lib/gitosis/templates/admin/hooks

Creating build/lib/gitosis/templates/default

Creating build/lib/gitosis/templates/default/hooks

Copying gitosis/templates/default/hooks/post-receive-> build/lib/gitosis/templates/default/hooks

Creating build/bdist. linux-x86_64

Creating build/bdist. linux-x86_64/egg

Creating build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/gitweb. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/gitdaemon. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/init. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/run_hook.py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/access. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/snagit. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/util. py-> build/bdist. linux-x86_64/egg/gitosis

Creating build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_repository.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_init.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/util. py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_access.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_group.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_assist.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_run_hook.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_serve.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_ssh.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/_ init _. py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_gitweb.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/test/test_gitdaemon.py-> build/bdist. linux-x86_64/egg/gitosis/test

Copying build/lib/gitosis/ssh. py-> build/bdist. linux-x86_64/egg/gitosis

Creating build/bdist. linux-x86_64/egg/gitosis/templates

Creating build/bdist. linux-x86_64/egg/gitosis/templates/admin

Creating build/bdist. linux-x86_64/egg/gitosis/templates/admin/hooks

Copying build/lib/gitosis/templates/admin/hooks/post-update-> build/bdist. linux-x86_64/egg/gitosis/templates/admin/hooks

Creating build/bdist. linux-x86_64/egg/gitosis/templates/default

Creating build/bdist. linux-x86_64/egg/gitosis/templates/default/hooks

Copying build/lib/gitosis/templates/default/hooks/post-receive-> build/bdist. linux-x86_64/egg/gitosis/templates/default/hooks

Copying build/lib/gitosis/templates/_ init _. py-> build/bdist. linux-x86_64/egg/gitosis/templates

Copying build/lib/gitosis/repository. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/group. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/app. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/_ init _. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/serve. py-> build/bdist. linux-x86_64/egg/gitosis

Copying build/lib/gitosis/mirror. py-> build/bdist. linux-x86_64/egg/gitosis

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/gitweb. py to gitweb. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/gitdaemon. py to gitdaemon. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/init. py to init. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/run_hook.py to run_hook.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/access. py to access. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/snagit. py to snagit. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/util. py to util. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_repository.py to test_repository.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_init.py to test_init.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/util. py to util. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_access.py to test_access.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_group.py to test_group.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_0000.py to test_0000.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_run_hook.py to test_run_hook.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_serve.py to test_serve.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_ssh.py to test_ssh.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/_ init _. py to _ init _. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_gitweb.py to test_gitweb.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/test/test_gitdaemon.py to test_gitdaemon.pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/ssh. py to ssh. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/templates/_ init _. py to _ init _. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/repository. py to repository. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/group. py to group. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/app. py to app. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/_ init _. py to _ init _. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/serve. py to serve. pyc

Byte-compiling build/bdist. linux-x86_64/egg/gitosis/mirror. py to mirror. pyc

Creating build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/PKG-INFO-> build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/SOURCES.txt-> build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/dependency_links.txt-> build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/entry_points.txt-> build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/not-zip-safe-> build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/requires.txt-> build/bdist. linux-x86_64/egg/EGG-INFO

Copying gitosis. egg-info/top_level.txt-> build/bdist. linux-x86_64/egg/EGG-INFO

Creating dist

Creating 'dist/gitosis-0.2-py2.6.egg 'and adding 'build/bdist. linux-x86_64/egg' to it

Removing 'build/bdist. linux-x86_64/egg' (and everything under it)

Processing gitosis-0.2-py2.6.egg

Creating/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg

Extracting gitosis-0.2-py2.6.egg to/usr/lib/python2.6/site-packages

Adding gitosis 0.2 to easy-install.pth file

Installing gitosis-init script to/usr/bin

Installing gitosis-run-hook script to/usr/bin

Installing gitosis-serve script to/usr/bin

Installed/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg

Processing dependencies for gitosis = 0.2

Searching for distribute = 0.6.10

Best match: distribute 0.6.10

Adding distribute 0.6.10 to easy-install.pth file

Installing easy_install script to/usr/bin

Installing easy_install-2.6 script to/usr/bin.

Using/usr/lib/python2.6/site-packages

Finished processing dependencies for gitosis = 0.2 # the installation is successful.


-- Configure the key and upload it to the Git Server

1) create a key on the Git Client

[Root @ Git-Client ~] # Ssh-keygen-t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/. ssh/id_rsa ):

Created directory '/root/. ssh '.

Enter passphrase (empty for no passphrase ):

Enter same passphrase again:

Your identification has been saved in/root/. ssh/id_rsa.

Your public key has been saved in/root/. ssh/id_rsa.pub.

The key fingerprint is:

D9: 8e: 54: e2: 45: 0b: 40: db: 4c: d2: 07: c1: 35: 4f: ee: 12 root @ Git-Client

The key's randomart image is:

+ -- [RSA 2048] ---- +

|. ++ = ++. |

| * Oo. * |

|. +. E o |

|. * O |

| S o. |

|. O. |

|... |

|

|

+ ----------------- +

2) Upload to Git Server

[Root @ Git-Client ~] # Scp ~ /. Ssh/id_rsa.pub root@192.168.40.128:/tmp/

The authenticity of host' 192. 168.40.128 (192.168.40.128) 'can't be established.

RSA key fingerprint is fe: 5b: df: 4d: ee: d2: e9: ed: 2c: e1: df: eb: ed: da: 84: 7e.

Are you sure you want to continue connecting (yes/no )? Yes

Warning: Permanently added '192. 168.40.128 '(RSA) to the list of known hosts.

Root@192.168.40.128's password:

Id_rsa.pub 100% 397 0.4KB/s


3) generate a Git user on the git Server

[Root @ Git ~] # Adduser git


4) import the Git Client secret key

[Root @ Git ~] # Su-git

[Git @ Git ~] $ Gitosis-init </tmp/id_rsa.pub

Initialize the empty Git repository at/home/git/repositories/gitosis-admin.git/

Reinitialize the existing Git repository at/home/git/repositories/gitosis-admin.git/


5) Delete the key

[Git @ Git ~] $ Su-

Password:

[Root @ Git ~] # Rm/tmp/id_rsa.pub

Rm: Do you want to delete the common file "/tmp/id_rsa.pub "? Y


6) Export Project Management on Git Client

[Root @ Git-Client ~] # Mkdir-p/repo

[Root @ Git-Client ~] # Cd/repo

[Root @ Git-Client repo] # git clone git@192.168.40.128: gitosis-admin.git

Initialized empty Git repository in/repo/gitosis-admin/. git/

Remote: Counting objects: 5, done.

Remote: Compressing objects: 100% (4/4), done.

Remote: Total 5 (delta 0), reused 5 (delta 0)

Grouping objects: 100% (5/5), done.


7) add and set management projects

[Root @ Git-Client repo] # cd/repo/gitosis-admin

[Root @ Git-Client gitosis-admin] # more keydir/root @ Git-Client.pub

Ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0HRA7sVa910FO/juESVyKY7ZL2J9TQKFpffHeQAVFmhMl

CAv/4cf1NIY7GK4xYjjAPvh9xMTGHFX06n/XNOGvoRev/w/2qmHldwxXepgKXVsBbI5oNxD1UUt7GIst1

/AKERThbeWYWrl1HAZ64WxS88e5/nVU/ix2IE3MKhGg2A9JhvAzdXxqMLR2T2TdLqi11CQ5cQxKt17K0 +

STiTQzIY1kGwV6UKf9Rq0EZA94/iLxRkb8NSyw0ouZxoMqsyezXArtM5mM7p/RU/js7mgR62PiYiY9iQP

1p89UtIRmibfRB5dTEEJSCAYJ91 + F7ZLFH9XcjSz4Md4pgNF9FZKWw = root @ Git-Client

[Root @ Git-Client gitosis-admin] # vi gitosis. conf

[Gitosis]

[Group gitosis-admin]

Writable = gitosis-admin

Members = root @ Git-Client

[Group test-git]

Writable = test-git

Members = root @ Git-Client


8) submit changes

# It must be executed in the directory of the gitosis. conf file

[Root @ Git-Client gitosis-admin] # git add.

# Add a user and email address for the first modification

[Root @ Git-Client gitosis-admin] # git config -- global user. name test

[Root @ Git-Client gitosis-admin] # git config -- global user. email test@163.com

[Root @ Git-Client gitosis-admin] # git commit-a-m "add test-git repo"

# On branch master

# Your branch is ahead of 'origin/master' by 1 commit.

#

Nothing to commit (working directory clean)

[Root @ Git-Client gitosis-admin] # git push

Counting objects: 5, done.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (3/3), 366 bytes, done.

Total 3 (delta 0), reused 0 (delta 0)

Git@192.168.40.128: gitosis-admin.git

C2ecaf1... 5e249ac master-> master


9) initialize, add, and use the tes-git Project

[Root @ Git-Client gitosis-admin] # cd/repo

[Root @ Git-Client repo] # mkdir test-git

[Root @ Git-Client repo] # cd test-git

[Root @ Git-Client test-git] # git init

Initialized empty Git repository in/repo/test-git/. git/

[Root @ Git-Client test-git] # touch test1 test2 test3

[Root @ Git-Client test-git] # touch readme

[Root @ Git-Client test-git] # git add.

[Root @ Git-Client test-git] # git commit-a-m "init test-git"

[Master (root-commit) ef505cd] init test-git

0 files changed, 0 insertions (+), 0 deletions (-)

Create mode 100644 readme

Create mode 100644 test1

Create mode 100644 test2

Create mode 100644 test3

[Root @ Git-Client test-git] # git remote add origin git @ zgit: test-git.git

[Root @ Git-client user-git] # git push origin master

Initialize the empty Git repository at/home/git/repositories/test-git.git/

Counting objects: 3, done.

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 208 bytes, done.

Total 3 (delta 0), reused 0 (delta 0)

Git@192.168.40.128: test-git.git

* [New branch] master-> master


10) check whether the Git Server is synchronized.

[Root @ Git ~] # Cd/home/git/repositories/

[Root @ Git repositories] # ls

Gitosis-admin.git test-git.git # There is a directory for synchronizing test-git, indicating success.

Git details: click here
Git: click here

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.