top of page
Search

USE OLD PC FOR HOME-MADE GIT SERVER



Source Code Management such as SVN or GIT is not strange with many programmers. I have already used these two, later I like and use GIT more. Many companies manage their source code with Bitbucket, and some use Github because they are cheap and let you use it for free. But when your project grows the storage capacity exceeds the quota, you will have to pay for their service. This policy is reasonable and acceptable for technology startups that require a lot of teamwork.


Personally, as a solo developer, I mainly work alone. The cost to cover such a service is quite a lot compared to my current ability. Fortunately, to use GIT for source code management, we don't necessarily need to use cloud services like Bitbucket or Github. Many online articles show us how to set up a Git Repository on a PC or laptop. So I won't cover this part anymore. This approach is a cost-effective way for solo developers like me.


However, there was a problem, and I almost lost a large amount of work when the hard drive I used to store the Git Repository had a problem. That is the disadvantage because my computer does not have a backup system like the cloud services. So when the storage hard drive crashes, I face the high possibility of losing everything. That reason drives me to think about an extra backup, such as a GIT server at home.


I have an old PC that I couldn't use for game development because its VGA was damaged. When I looked at the PC, I wondered why I don't use it as a GIT server. There are hundreds of spare gigabytes in three HDD, and its old core i7 is good enough to handle the job. I think leveraging the old one instead of tossing it in the corner is a good choice for a green life. Especially, recycling stuff is also an economical way in the time hardware price soars high because of the supply chain problem and the invasion of Putin at Ukraine.


Here is my process:

  1. In the first step, I shared the folder on my old PC for public access via a local network with the WIFI router. That folder holds all the GIT repositories that I need to back up. You can find many tutorials to share a folder on a local network for Windows 10 out there. I will skip all the details because it's easy.

  2. The next step is creating a clone for my origin repository on the laptop. There are two ways to clone the original one. The first approach is accessing the shared folder (on the PC) from my laptop computer and using the "git clone --mirror --bare" command. The second approach is using the fast drive. Just copy all the repositories from the laptop and put them in the shared folder of the PC directly. This way is faster for the large-size repositories, which is more than 1GB, and when the local network speed is not good enough.

  3. After that, I changed the directory on my laptop to the working folder and added the new remote for the GIT setting with the URL point to the shared folder via a mapping network drive. You can do this with the "git remote add" command or use GIT GUI.

  4. The last thing is synchronization between two repositories. I used the "git fetch" and "git push -all" for the changes on the project after every commits. You need to keep the order of the GIT commands (fetch and then push) to make it works.


Once you understand the essence of those git commands, using the GUI will save you a lot of time. I prefer Tortoise Git for its lightweight and easy to use. I used Source Tree before, but it's not my favorite because it's too slow and heavy. Another thing I learned is if I had enough budget to cover the cloud services cost, I would never know what I shared in this post.

Recent Posts

See All

Comments


THANK YOU!

bottom of page