Git is a versioning system developed by Linus Torvalds, the founder of Linux. Git is used my millions of people across the globe. It is a perfect replacement to subversion, another Linux versioning system. In this tutorial we will learn how to setup and configure own Git server on CentOS 6.x.
Git is available in the CentOS default repository. We can install it using the following command.
yum install git
This will install Git along with all its dependencies. Once it is installed we will proceed towards the setup.
It is recommended to provide your name and email address. Following are the commands to set the same.
git config –global user.name “Your Name Here”
git config –global user.email “your_email@example.com”
The configuration changes will be stored in a file in your home directory. It can be seen by any editor or a simple cat command
cat ~/.gitconfig
The output will be something like
[user]
name = Your Name Here
email = your_email@example.com
This information can be also viewed by querying git.
git config –list
Output:
user.name=Your Name Here
user.email=your_email@example.com
If the above details are not filled, then they will be filled automatically.
Now we will create our first Git repository.
1. Logon to the server using root.
2. create a new directory
mkdir /home/git
3. Now we will create our first git directory inside the directory created in step 1.
mkdir first_directory.git
4. Now, we will change the working directory to the newly created directory.
cd first_directory.git/
5. Now it’s time to initialize the directory.
git init
We will now create the initial repository on the client machine.
mkdir example
cd example
git init
Add a file
touch TEST
Now add the new file to the repository.
git add TEST
Commit the changes
git commit
Now, we will add the address of the remote repository
git remote add origin ssh://root@remote_server/home/git/first_directory.git
Now push the commit to the remote repository.
git push origin master
If you wish to setup git server for multiple users and multiple repositories, you may try either gitolite or gitosis.
Setting up your first Azure Virtual Machine can be done by following these steps: Create…
Amazon CloudFront is a content delivery network (CDN) that helps you serve static content such…
Step-By-Step Guide To Setting Up An AWS Application Load Balancer Are you looking for a…
MySQL databases often get corrupted due to issues like hardware failure, file system failure etc.…
SQL Server Replication is the process of copying databases from one node to another to…
Here are 101 System Admin tools which make System Admins' life easy.
This website uses cookies.