Set Up Your Own Git Server
Linus Torvalds developed Git as a versioning system. Millions use it across the world with hosting services like GitHub, GitLab and many others. According to the survey, GitHub has been leading as the largest code hosting service around the world. There are more than 9.2 million people who are collaborating through the 21.8 million repositories on GitHub. Big companies around the world are heading towards GitHub and find their solutions within the competitive market.
Here is how you can set up your Git server within the organization.
There are two names which you have to learn, the first one is a local server, and the other is a remote server. The work will be between these two machines to make it simple.
Install Git on both of the machines and use this method following.
Sudo apt-get install git-core
Next, if you want to add the user, put this command:
Sudo useradd git
If you want to set up the password for the server then first you have to create the ssh keys with the machine you are working on:
Ssh-keygen – t RSA
Next, hit enter for the default location and then pass this phrase for the remote access on the server.
cat ~/ .ssh/id_rsa.pub | ssh git@remote-server “mkdir –p ~/ .ssh && cat >> ~/ .ssh/authorized_keys”
Now you have the option to create the directory for the project towards Git. Here is the desired command to enter:
git@server:~ mkdir –p /home/swapnil/project-1.git
following that directory, enter:
cd/ home/swapnil/project -1.git
for the empty repo:
git init –bare
initialized empty Git repository in /home/swapnil/project -1. Git
now you have to create the Git repo on the same machine
mkdir –p /home/swapnil/git/project
to add file:
Let's assume that you are using GitLab as the client which can be a great solution for collaboration and project success. Here you can run the project management system which contains its server. The similar service is there with the team members to release the contributions publicly.
So download GitLab and then run the following functions:
As you install the client, there are
“root” settings by default which are for the system admin. It uses the password of
“5iveL!fe” so you can then sign in and change the password if you want to. It is better to change the password to maintain security.
As you change the password upon logging in, you can start to manage the project efficiently. There are various features with GitLab which you can avail and choose multiple options. With the support for large files, you can keep all the assets at one place at Git lFS. The smart branching option is there with keeping the repositories clean and making efficient developments.
You can also manage the submodules to align projects and have its dependencies with grouping the projects together. Sourcetree is there to help you change the files, commits and also bring the branches in the right spot. You have the option to keep the rebase tool active with clearing and cleaning the commits often.