How To Host Your Own Git Server on Amazon EC2 Instance.



How To Host Your Own Git Server on Amazon EC2 Instance.

Git and GitHub  are considered as most powerful source code management tool that provides several benefits for developers and teams working on software projects. 

Various Features for which git is considered as one of the best source code management tool in IT Industries now-a-days are as follows :-

Version Control :- Git enables you to track changes to your codebase over time. It allows you to create commits, which represent specific points in your project's history. This helps you keep track of what changes were made, who made them, and when. Git also provides powerful branching and merging capabilities, allowing you to work on different features or bug fixes in parallel and easily merge them back into the main codebase.

Code Integrity:- Git helps maintain the integrity of your codebase by preventing accidental loss or corruption of files. It stores a complete history of every change made to the project, making it possible to revert to a previous state if necessary. Additionally, Git has built-in mechanisms to detect and resolve conflicts when multiple developers make conflicting changes to the same file.

Branching and Workflow Management: Git offers powerful branching capabilities that allow you to create lightweight branches to work on new features, bug fixes, or experiments without affecting the main codebase. Branches provide an isolated environment where you can make changes and test them independently. Git also supports various workflow models, such as GitHub Flow, which provide guidelines on how to structure branches and manage the development process.

Distributed Development: Git is a distributed version control system, which means that each developer has a full copy of the repository on their local machine. This allows developers to work offline, commit changes locally, and synchronize with the central repository when they are connected to the network. Distributed development provides flexibility and resilience, allowing teams to work effectively even in situations with limited connectivity or network disruptions.

So, Git and GitHub basically provides various features in context of source code management, enabling efficient collaboration, efficient management of code base, distributed development makes it a keen tool for each and every IT Industry.

Therefore, There is need in every It Industry to launch their own Git server on cloud because it provides high availability, high Scability, and  high reliability at the same time.

This blog basically demonstrates about how to setup a your own git server on cloud following this simple steps :-

1. You need to setup (3 Or more ) Ec2-Instances from AWS management console and successfully install git on all the servers.


You can install git by this command :- yum install git ( Amazon Linux) 
In ubuntu command is :-  apt install git

We can also check that whether git is successfully installed on our servers or not through the command :- git --version 



Command that should executed only on the master server in order to initialize the master server as the remote server is :- git init --bare


Command to be executed on all worker server to initialize the empty .git local repo are :-

git init
git config --global user.email "< Enter your email >"
git config --global user.name "<Enter your name>



Step 2:- In order to connect the worker servers to master server we need to enable password less authentication between all the three servers.

In order to configure the password less authentication follow the following steps :- 

Command to generate the public keys of server is :- ssh-keygen (to be executed on the worker servers)




Then you need to copy the SSH key to respective slave servers in order to establish a password less authentication between the master GitHub server and slave servers or developer servers.


Command to copy the SSH key is :- ssh-copy-id root@<private ip of the server to which you want to copy the key>

Note :- Copy the same key to from the slave servers to GitHub master server or the existing key will be overridden and password less authentication between master and slave servers cannot be established.


Then configure the global credentials on the developer servers.


Now the setup is complete and you can use the master server as a remote GITHUB server to store and manage your source code.



After that you can check the logs of the master server in order to verify the commits of different developers.

command to check the git logs :- git log 


In this way you can create your own Git master server for source code management with additional security measures as this type architecture enables to store your code repository privately.

Thankyou.

Sibasish

I am a student pursuing Computer Science and Engineering at Silicon Institute of Technology. I am always eager to explore the world of computer Science and software development . Main areas of interest include Web-development, Machine Learning, and Cloud Computing.

Post a Comment

Previous Post Next Post