Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

git - Duplicate Local Repo at different location so that changes made on Location 2 also apply to Location 1 locally (Windows)

I have a machine2 that has the resources I need to test a space consuming app. The issue is that machine has a firewalls that make it hard to pull and push commits to gitlab. Machine1 is where I do my development then I have to copy things over to machine2 to run the service

I wanted to see if there's a way to copy/duplicate/clone my local repo on machine1 to machine2 so that if i make changes in machine2, the changes will be reflected on machine1. So that all I need to do is to push commits from machine1 to the remote repo.

Is this possible? The 2 machines are on the same network and I can access both from each other in File Explorer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Opinion based, but...

You can use Syncthing which works fine even for git repositories. It can watch for the filesystem changes and copy automatically even large files and a lot of them as well. It has a REST API so you can manage it even remotely. I've used it for multiple and more than 200GB folders and runs smooth and without any significant issues. That's if you like more GUI-like approach or more scalable solution where you don't need to care about a lot of manual setup.

Alternatively, with more granular control, you can use RSync if you want to sync only specific folder and cron for scheduling the sync.

Alternatively, manually you can either create a git submodule(of remote) in two repositories (machine1 and machine2) and on each change you'll sync them with git submodule update or use a single repo and mirroring a single git repo between multiple machines.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...