Install Git on UbuntuServer

Source: Internet
Author: User
First install SSHServer: Open the UbuntuServer terminal and enter the following code: sudoapt-getinstallopenssh-server to generate the RSAKey (Please su to the common user to execute this command ): ssh-keygen-trsa: modify the configuration file/etc/ssh/sshd_config: Port22 # To the desired login port, such as 2222 PermitRootLog.

First install the SSH Server:

Open the Ubuntu Server terminal and enter the following code:

Sudo apt-get install openssh-server

Generate an RSA Key (su to a common user to execute this command ):

Ssh-keygen-t rsa

Modify the configuration file/etc/ssh/sshd_config:

Port 22 # change to the login Port you want, such as 2222

PermitRootLogin no # prohibit root User Login

StrictModes yes # Check whether the key user and permissions are correct.

RSAAuthentication yes # enable RSA Authentication

PubkeyAuthentication yes # enable Public Key Authentication

PasswordAuthentication no # password authentication is disabled. It is enabled by default.

ServerKeyBits 1024 # change the intensity of ServerKey to 1024 bits after modification

PermitEmptyPasswords no # change to this status after modification. Do not log on with a blank password.

Copy the id_rsa file to the Client ~ /. Ssh/directory, copy id_rsa.pub to the Server end ~ /. In the ssh/directory, change the name to authorized_keys and restart the SSH service:

Sudo/etc/init. d/ssh restart

Install Git software:

Sudo apt-get install git-core

Install Gitosis:

Mkdir ~ /Src

Cd ~ /Src

Git clone git: // eagain.net/gitosis

Cd gitosis

Sudo python setup. py install

Add git users:

Sudo adduser-system-shell/bin/sh-gecos 'git version control'-group-disabled-password-home/git

Initialize the git directory. USER indicates the USER on the current server:

Sudo-H-u git gitosis-init Sudo chmod 755/home/git/repositories/gitosis-admin.git/hooks/post-update

Run the following command on the Client:

Git clone git @ YOUR_SERVER: gitosis-admin.git

Cd gitosis-admin

Add the following in the gitosis. conf configuration file:

[Group myapp]
Members = vince @ urbanpuddle
Writable = myapp

Then submit:

Git commit-a-m "created a new repository"

Git push

Create directory and submit File

Mkdir myapp

Cd myapp

Edit. gitignore to add the file to be ignored

. DS_Store

Then execute:

Cd myapp
Git init
Git remote add origin git @ YOUR_SERVER: myapp. git
Git add.

Git commit-a-m "initial import"
Git push origin master: refs/heads/master

This article comes from:Http://blog.douhua.im/2009/05/19/ubuntu-server-git/

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.