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.
- 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.
- Create a folder where you want to create the Git Server.
- Move into that folder, right click and select Git Bash Here option. This will open a bash command window in the current folder.
- Run the command git init anyname.git –bare to initialize Git bare repo without the working directory.
That’s it. You have successfully set up your Git server. Simple as it is, isn’t it?
Connecting to Local Git Server
- 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.
- 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.
- 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.
- Once the permissions are set, you will find a share path.
- Go to second Windows PC and open Git terminal and type git clone //GitServerName/PathToGitServerFolder.git command.
- You can create new files and folders as if you do on a normal Git account.
That’s it. You have successfully created your own Git Server and published on the network.