Set up a git server-use git-daemon

Source: Internet
Author: User

Git is a good version management tool. Now I am working on a simple application development and want to use git for management. After Google's Configuration documentation, I still suffered more than N setbacks. Some documents are of low quality, which wastes a lot of time ......

 

Well, let's get started:

Install necessary git tools

# Apt-get install git-core

 

After installation, Set

1. Create a git directory

# Mkdir/git

# Cd/git/

# Mkdir myproject

2. Create an empty git Repository

# Git-init-db

3. Create a project file

# Echo "My test project"> test.txt

* This step is very important. to remotely clone this project, this project must be non-empty; otherwise, it will fail.

4. Use the git command to add and submit new files

# Git-add test.txt

# Git-commit-m "Init"

 

Now, the local git repository has been created. To remotely clone this project, you also need to use git-daemon

5. Install git-daemon-run. git-daemon-run, which is a script management tool used to start git-daemon.

# Apt-get install git-daemon-run

6. Configure git-daemon-run

# Vi/etc/sv/git-daemon/run

We can see that

#! /Bin/sh
Exec 2> & 1
Echo 'git-daemon starting .'
Exec chpst-m64000000/

Git-daemon -- verbose -- base-path =/var/cache/git

 

Change the git-daemon of the last sentence

Git-daemon -- verbose -- export-all -- base-path =/git/

 

* Here, I added -- export-all. you can see the man manual. After using this option, you do not have to create the git-daemon-export-OK file in the git repository. If this option is not used, you need to create the file in step 1, that is

# Touch git-daemon-export-OK

 

7. Restart git-daemon.

We modified the git-daemon configuration file and need to restart the service.

# Sv down git-daemon

# Sv up git-daemon

8. Export the myproject on the server (192.168.35.69) from the client

Git-clone git: // 192.168.35.69/myproject

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.