2

My team and I use a git repository to keep track of our projects. This repository is cloned in our Windows PCs that we use to develop most of our software. However, we also use another machine ( a linux VM, which we access through ssh ) to develop other parts of our software.

The idea here is to keep track of the files/directories in this virtual machine and sync them to git. The trivial (and current) solution is to manually copy the files from the VM to our PCs, and then commit them to git.

I am sure there is a better way of doing this without having to manually copy the files every time we make some changes. Suggestions are greatly appreciated!

Edit: I should have added that the git project is quite big (~3.5 GB) and the VM has limited space, therefore I cannot clone the whole repo in the VM

3
  • Is there some reason the repository can't be cloned onto the VM and changes committed and pushed directly back?
    – Blrfl
    Jun 6, 2019 at 10:13
  • 1
    use git on the VM ?
    – Pieter B
    Jun 6, 2019 at 10:30
  • That git project is huge and the VM has limited memory, this is why we didn't clone the repo in the VM
    – AirBlast
    Jun 6, 2019 at 10:49

1 Answer 1

1

Install Git on the Linux VM and commit directly from there. Of course, your Linux VM must be able to connect to the central repo, but as you can read here, it is perfectly possible to use SSH for this. The server where the repo is located must provide an SSH access for this, of course.

If that is not possible for some reason, there is also the option of automating what you are currently doing manually:

  • write a shell script for copying the changed files from the Linux VM to your source tree on Windows (WinSCP is your friend, it can be automated by command line parameters; PuTTY may also be used)

  • then after running this script, you can commit from the Windows PC.

I would also consider to automate the other direction as well: copying the relevant files from Windows to the Linux VM, which becomes relevant if you have more than one local VM environments, for example, one for each team member.

4
  • Thanks for your answer, the problem is that the git project is huge and the VM has limited memory, this is why we didn't clone the repo in the VM in the first place. Is there any way to clone just part of the project in the VM?
    – AirBlast
    Jun 6, 2019 at 10:55
  • 1
    @AirBlast filters and sparse checkouts.
    – Blrfl
    Jun 6, 2019 at 11:38
  • @AirBlast: see my edit.
    – Doc Brown
    Jun 6, 2019 at 12:39
  • Thank you for your answers @DocBrown and Blrfl ! I will try to come up with some script (if cloning a part of the repo proves to be too complicated) and I will post what I come up with.
    – AirBlast
    Jun 6, 2019 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.