Here is the situation. I have a remote git repository on Server A. Also, I have to work on Desktop B with the same source code in this repository. Because of the limited bandwidth to access Server A, I'd like set up a local mirror on Desktop B for the repository.
Now, I have set up the mirror repository by
git clone --mirror https://repository-on-server-a /local/repo/path.git I have tested the local repository by
git clone file://localhost/local/repo/path.git Then I modified crontab to do
cd /local/repo/path git fetch -q to sync up every 5 mins. It works well.
At the beginning, I was thinking about using
git config --global url.file://localhost/local/repo/path.git.insteadOf https://repository-on-server-a to have git fetch all objects from local directory instead of a remote repo. However, it doesn't work.
My question is
- Is there a simple way to set up such local mirror for a remote git repo?
- How to handle 'git push'? Since the insteadOf will get every push into local directory, how could I push all my changes back to Server A?
The local directory is for a test but not the final solution. I will have another Desktop C to get source code from Desktop B later. Another colleague will join me too. That means we want to put all changes in Desktop B to have some 'centric' solution for us.