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/