Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup an intermediate git server? And is it advisable?

Current Situation

My team is based in Singapore. We needed to install a Django web app inside China for speed reasons for an enterprise client for intranet usage.

enter image description here

So we did it like this.

What's wrong?

The git clone is painfully slow and our files are > 50 mb.

What have you tried?

I am thinking of setting up an intermediate server in HongKong to reduce the latency for git clone.

enter image description here

Maybe the diagram is a bit off.

We used CircleCI. I think we can get CircleCI to have the following setup.

Whenever GitHub received an update on the master branch of our repo, the HongKong server will pull the latest master branch copy down.

For the China server, I guess I can configure it to do a git pull every day at some off peak hours using cronjob.

So what's your issue?

I can google for the git setup steps quite easily like this https://git-scm.com/book/en/v1/Git-on-the-Server-Setting-Up-the-Server

My concern is whether my approach described above makes sense.

If it makes sense, then my question is how do I configure the CircleCI to do that?

Our team experience with CircleCi is limited to having it work with GitHub and Heroku. We never have used it with GitHub and a standalone server which we will operate on.

like image 306
Kim Stacks Avatar asked Sep 22 '16 07:09

Kim Stacks


People also ask

Can I host my own git server?

Git allows you to host your own Git server. Instead of setting up your own server, you can also use a hosting service. The most popular Git hosting sites are GitHub and Bitbucket. Both offer free hosting with certain limitations.

Do you need a server for Git?

Even though a central server may make things somewhat easier, you don't need one. At work, I use some scripts around git-bundle to synchronize my git repositories between machines that are not connected to networks in a way that they can access each other.

What is your preferred protocol for Git operations?

The default on both GitHub.com (the website) and in GitHub CLI is using the HTTPS protocol for git operations. This default was chosen for interoperability and ease of use: Git users who are behind firewalls find that traffic to port 443 (HTTPS) is more often allowed than traffic to port 22 (SSH).


1 Answers

You can use a shallow clone in the China server to improve git clone's performance.

For example, if you want only the last version:

git clone --depth 1 <repository-url>

You say that your files are > 50 MB, so it will still take a bit to clone if there are many of them, but at least you only download them once.

like image 83
vguzmanp Avatar answered Sep 28 '22 21:09

vguzmanp