Git server in ubuntu

Source: Internet
Author: User
Article Title: git server in ubuntu. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Server:

A @ ubuntu :~ $ Sudo apt-get install git-core

A @ ubuntu :~ $ Sudo apt-get install openssh-server

A @ ubuntu :~ $ Sudo apt-get install openssh-client

The newly added git user will act as the administrator of all code repositories and user permissions:

A @ ubuntu :~ $ Sudo useradd-m git

Set a password for git:

A @ ubuntu :~ $ Sudo passwd git

Install the python setup tool to prepare for gitosis:

Apt-get install python-setuptools

Git clone git: // eagain.net/gitosis.git

Cd gitosis

Python setup. py install

Client:

Shh git @ Server

After logging on to the server

Mkdir example. git

Cd example. git

Git -- bare init

Cd

Ssh localhost

Exit

Client:

Generate an ssh key and upload it to the git server

Ssh-keygen-t rsa

Scp ~ /. Ssh/id_rsa.pub git @ server :~ /. Ssh/

Ssh git @ Server

Cat ~ /. Ssh/id_rsa.pub> authorized_keys

Chmod 755/home/git

Chmod 700/home/git/. ssh

Chmod 644/home/git/. ssh/authorized_keys

Chmod 755/www/git/repositories/gitosis-admin.git /\

Hooks/post-update

Exit

Mkdir example

Cd example

Git init

Touch README

Git add README

Git commit-m'first commit'

Git remote add origin git @ server: example. git

Git push origin master

I think it is too difficult for me to build a server on the Internet, but I think some of them are by default. At this stage, my linux is not very strong, just be stupid. to generate an ssh key and upload it to the git server, it must be on the client. I can't go through this process for a while.

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.