Ubuntu: a simple git private service

Source: Internet
Author: User
The git server setup process record is as follows: Environment: The Ubuntu virtual machine (Boss) can be accessed through the network (the git server setup process record is as follows: Environment: the server's Ubuntu virtual machine (Boss) can be accessed through the network (server address: 192.168.9.103 ). Client Win7 computer (work)
Software Requirements: Client software msysgit: http://msysgit.github.io/software version: Git-1.9.2-preview20140411.exe client software TortoiseGit: http://dl.oschina.net/soft/tortoisegit software version: TortoiseGit-1.8.6 server software Git: https://www.kernel.org/pub/software/scm/git software version: git-1.9.2.tar.gz
I. client msysgit installation:
2. client TortoiseGit installation:
III. server Boss Git installation: # apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \ libz-dev libssl-dev, download the latest source code from the following Git official site: http://git-scm.com/download
Then compile and install:
#tar -zxf git-1.9.2.tar.gz#cd git-1.9.2#make prefix=/usr/local all#sudo make prefix=/usr/local install
 
 
 
 

Add git users and git User groups on the server
# Mkdir-p/home/git # groupadd git # useradd-g git-d/home/git-s/bin/bash git # passwd git # set git User password # change git directory permission # chown-R git: git/home/git # chmod-R 2755/home/git
 
 
 
 

4. achieve client (work) SSH authentication without a password login server Boss: first open Git Bash, run the command: ssh-keygen.exe production ssh key, such:
The generated key is in the. ssh directory in the user's home directory. Upload the public key id_rsa.pub to the server Boss:
$scp ~/.ssh/id_rsa.pub git@192.168.9.103:/tmp/
Then log on to the server using the git User:
$cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
In this case, ssh is successfully configured when the client logs on to the service through SSH.


5. create a Git repository on the server
$mkdir test.git$cd test.git$git --bare init
 
 
 
 

6. configure user information in client Git Bash. The first one is your personal user name and email address. These two configurations are very important. Each Git commit will reference these two configurations, indicating who submitted the update and will be permanently included in the history together with the updated content:
 
 
 
 
$git config --global user.name "John Doe"$git config --global user.email johndoe@example.com

7. configure the client Git Bash on the test client and server:
$cd test$git init$git add .$git commit -m 'initial commit'$git remote add origin git@192.168.9.104:/home/git/test.git$git push origin master
Or
$git clone git@192.168.9.104:/home/git/test.git$cd test$touch test.txt$git add test.txt$git commit -m 'test commit'$git remote add origin git@192.168.9.104:/home/git/test.git$git push origin master
If the configuration ends, the configuration is successful.







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.