Build your own Github - Git Server setup
we'll be building our own Git server from scratch. This will give us a deeper understanding of how Git works under the hood.
Go to AWS and launch EC2 instance having Ubuntu as OS.
SSH into your instance. check username by running command
Add user id as a git by running below command
4. Provide access by giving permission to git user by running below command. sudo su -R git /var/lib/git
5. create directory in the path /var/lib/git
6. The command git init --bare
is used to create a special type of Git repository called a bare repository.bare repository doesn't contain a working directory. This means it doesn't hold the actual files you're working on. Instead, it only stores the Git metadata – the commit history, branches, tags, and other information about your project.
7. Run the git clone command to clone the repository which you have created in step 6. it will give error as "permission denied"
8. In the local you have to generate SSH keys for windows which you have to add in the remote bare repository so that you can clone and then push the required changes to remote Github server. Refer link https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
once this step is successfully done then add ssh keys in remote server. For that create authorized_keys file in .ssh folder of git user and then run git clone command and now it should run successfully.
9. you can run command git remote -v. This command is used to list all the remote repositories associated with your local Git project and shows details about them, including the URL and the configured fetch refspec.
10. also configure below commands so you can track changes
git config --global user.email you@example.com
git config --global user.name "Your Name"
Create one index.html file and commit changes locally and push the changes to remote repository.
11. Verify the commit id on remote server and it should be the same.
12. perform the 2nd commit and push them to a remote repository.
13. To install a Git GUI on Ubuntu or Debian-based systems, you'll need to follow these steps: 1. Install Ruby - sudo apt install ruby
2. Install GitWeb: GitWeb is a web interface for browsing your Git repositories. You can install it using: sudo apt install gitweb
3. Start the GitWeb service: This command activates the GitWeb interface:git instaweb --httpd=webrick
please note this approach creates a basic Git GUI accessible through a web browser. There are other graphical Git clients available that might offer a richer user experience. You can search online for alternatives depending on your preferences.
14. you need to edit the inbound rules and add port number 1234 (as per step 13).
15. By adding port we can access GIT UI
16. Perform the 3rd commit and view the change in UI
17. create second project and clone the repository to local. After creating project make the required changes locally and push it to remote server and view the changes in GIT UI.
18. Similarly you can create new feature branch in project 2 and track the changes in it.