Recently, I was tasked to setup an on-premise Git server to store a source code repository of one of our developed software. Me as a noob about Git, I know there is no such thing as "Git Server" technically.
I was so confident, Git doesn't have its own server and arrogantly read one of their documentation until I found this, 4.2 Git on the Server - Getting Git on a Server. A demonstration on how to setup Git on a Linux-based server.
According to Git, this can also possible to run on Windows Server. So, I tried it on one of our test Windows Server VM. Found this tutorial on YouTube
The Setup
Windows Server VM:
Install Git (Git UI or Git Bash are optional to include but highly recommended)
-
Create a folder and share this folder in the network (make sure to share this within your organization).
- Right click and select Properties
- Click share and add the organization
- Set it to Read/Write
- Copy the network shared file path (need it for later)
- Initialize a Git bare repository inside the folder
git init repo <YOUR_REPO_NAME> --bare
Client Laptop (My Laptop):
Install Git (Git UI or Git Bash are optional to include but highly recommended)
Setup a global username and email (if you are using a domain account, Git will automatically fetch your name and email)
git config --global user.name "YOUR_NAME"
git config --global user.email "YOUR_EMAIL"
- Allow sharing across users (need to allow this to avoid error in cloning)
git config –-global –-add safe.directory YOUR_REPO_DIRECTORY
- Clone the repository
git clone YOUR_REPO_DIRECTORY
Done!
I accessed the repository using Visual Studio Code. Modified, commit and pushed some changes. Preem! It works!
I tried to access this using the GitHub Desktop but unfortunately, GitHub desktop does not support bare repositories, as an alternative I used Git Extensions.
Conclusion
Technically, this is not the "Git Server" that you might expect, a service running on a server and accessing it via IP address on port 3000. Gitea might be the one you're looking for since this is just a network shared folder with a bare git repository.
I currently have no idea if this is good in the long run. This might be good for small set ups with few projects and developers. Since we will not fully utilize this, this setup will be good for small company.
This is probably not scalable, I think? and some complicated aspects like user management are not configured. Setting up a read-only repositories for certain users might be a challenge and this might not be the recommended setup at all.
Thank you for reading!
Top comments (0)