Table of Contents
This is a simple resume on bringing online git server repository + client accessing it.
Make sure you have git installed – the easiest way is by using your distribution’s package manager.
Example Server Setup
We assume that we have the following basic straight-forward sever setup :
– Git Server –> server.example.com
– Git Client –> client.example.com
Server-Side project creation
Login to server.example.com (Your future git server) and execute the following commands
# Create system user for the repo adduser git # Give some good password passwd git # Login with the newly created user su - git # Initialize bare git repo cd /home/git git clone --bare my_new_repo my_new_repo.git
Now we have our empty bare project repository.
At this moment, the 2 basic methods we could use to work with this repo are as follows:
– By using the newly created user git and it’s password
– By creating public/private key pairs for user git and give them to the users which will work with this repo
Currently we will use the simplest method of using plain old user/pass authentication through SSH.
Client-Side project creation
Login to the client server (client.example.com) and execute the following:
# Create some example project directory mkdir new_project cd new_project # Add some dummy files touch 1 2 3 4 5 6 # Now clone here our newly created repo git clone git@server1.gryzli.info:/home/git/my_new_repo.git # Make initial commit and add all of the newly created files (1..6) git add . # Commit them git commit -m "Sample commit comment" # Now add our remote repo git remote add origin git@server.example.com:/home/git/my_new_repo.git # Finally push all of the changes to the remote repo git push origin master
Optional Client-Side configurations
Here are some basic configs you may want to do after newly installed git.
# Configure your name and email git config --global user.name "Gryzli Bugbear" git config --global user.email "email@example.com" # Configure global editor git config --global core.editor vim # Configure diff tool git config --global merge.tool vimdiff # List current configuration settings git config --list
References
Detailed documentation concerning all aspects of GIT.