Contents

How to setup Git Server locally

Website Visitors:

So far you might have used external Git providers like GitHub, GitLab or Bitbucket, etc… or Git software programs like Gitea or Gogs, etc… as your version control systems. But do you know you can also set up a Git Server locally on your PC?

Started thinking about it already? Let me show you how.

Prerequisites

  • Two PCs with Git software installed. This tutorial uses two Windows PCs for the same.

Creating Git Server Locally

Let’s see how to create a Git Server locally.

  1. Create a folder where you want to create the Git Server.
https://www.mediafire.com/convkey/8066/18drao0cdw0l1q39g.jpg
Git Server Folder
2. Move into that folder, right click and select Git Bash Here option. This will open a bash command window in the current folder.

https://www.mediafire.com/convkey/f102/te4k44h3wn454hs9g.jpg
Git Bash Here command
3. Run the command git init anyname.git --bare to initialize Git bare repo without the working directory.

https://www.mediafire.com/convkey/020c/9pvf48f19cn8opj9g.jpg
Git Init command
  1. You have to enable sharing and firewall options so that this Git server will be visible on network. On your Git server, Go to control panel → Network And Sharing Center > Change advanced sharing settings. Select Turn on network discovery option and Turn on file and printer sharing option.
https://www.mediafire.com/convkey/2499/il9q2sqlc6tk8c79g.jpg
File and Printer sharing in control panel
5. On your Git server, Go to control panel → Windows Defender Firewall → Advanced Settings → Inbound Rules. Enable File and Printer Sharing (NB-Name-In) on private,public profile and File and Printer Sharing (SMB-In) on private, public profile as shown below.

https://www.mediafire.com/convkey/643c/h6i5g1zdde6aexo9g.jpg
File and Printer sharing option in firewall
6. Go to the folder you have created Git Server, right click and select properties. Under sharing tab, click Share and add Everyone. Set the permission level as Read/Write.

https://www.mediafire.com/convkey/aad1/y1ozeartr2mk2so9g.jpg
Sharing Permissions
7. Once the permissions are set, you will find a share path.

https://www.mediafire.com/convkey/260c/oohjqytoromwnfx9g.jpg
Share Path

Connecting to Local Git Server

  1. Go to second Windows PC and open Git terminal and type git clone //GitServerName/PathToGitServerFolder.git command.
https://www.mediafire.com/convkey/a345/aoipl8ttmp03bl9zg.jpg
Git Clone
2. You can create new files and folders as if you do on a normal Git account.

https://www.mediafire.com/convkey/5c2a/raqivou805ioe4m9g.jpg
Git Status and adding files to Local Git repo

That’s it. You have successfully created your own Git Server and published on the network.

Want to learn more on Citrix Automations and solutions???

Subscribe to get our latest content by email.

If you like our content, please support us by sponsoring on GitHub below: