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