Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
If you are a regular user of git, you must know that everything is about repositories and operations on these. Repositories are first and foremost directories which main purpose is to contain data or files that will be shared between many people.
Understanding so, you can set up your own server without using Github or Gitlab. For this tutorial, we are going to do it on windows 10.
Let’s jump in !
- Go to Git — Downloading Package (git-scm.com) to download the current version of Git. Install it normally on your Windows 10 machine.
- After geeting Git installed, create a new directory anywhere on your computer.
Let’s call the new directory git-server. Open it then in a powershell or Windows command prompt.
Tap the following to initialize a new repository in it :
git init myRepoName — bare
This command means that we create a new repository named “myReponame”. - Come back to file explorer and make a right click on git-server, select Properties → Sharing → Share Button.
A modal will then appear, click on the dropdown annd choose EveryOne and click on Add button at the right. After doing so, change this group rights on his right side by selecting Read/Write and Click on Share.
You will get a following screen with a similar information to this.
Notice that DESKTOP-IV3TUO8 is my name Computer name. SO you’ll get yours accordingly.
4. Create another directory git-client to make operation on the previous repository.
Step into git-client directory and clone myRepoName from git-server.
As you can see the clone operation was successful.
5. Now let’s create a text file into our git-client and push changes to git-server.
In order, this is what I have done :
- I create a new text file
- I add the text file to git for commit
- I do the commit
- Finally I make the push.
This is all for creating your private git server !!
Hope that It will help doing the same.
Reach me out if getting any isssue !