Is it possible to execute git commands remotely?
Asked by Steven Johnson:

Hi,

This might be possible (or possibly a stupid question) but I'm not too familiar with git in general and I can't figure out how to do this. Basically, I have the following scenario:

The project is built remotely on a Linux host. The source code is located on this Linux host in a git repo. However, this repo is huge.

I have a share on a Windows system where the same repo is visible. However AFAIC, this is not a supported scenario for SourceTree, although I can open it in SourceTree but it is extremely slow, and essentially unworkable (ST takes about 20 minutes to open the repo).

An alternative is to clone the repo to the Windows system, and this works better, but I would really like to view the **remote** repo directly in SourceTree over ssh as opposed to a locally cloned repo that is configured to use the Linux repo as a remote.

So my question is... Is it possible to configure SourceTree so that it executed the actual git commands remotely over ssh? This should be much faster, and I would not need to have a locally cloned repo.

Thanks in advance for any help!


Answers:
author: bgannin
body: Hi Steven,

Sourcetree is optimized to work with local repositories. There isn't a way to 'view only' for a remote repository and send commands with the app. I would recommend using the git CLI to achieve your goals here if cloning isn't really an option.

Brian Ganninger  
Product Manager, Sourcetree

comments: author: Steven Johnson
body: Thanks for the reply.

Using the git CLI would negate the whole purpose of using SourceTree.

I understand this isn't a very common use case, but I can't be the only one that would find using a repo remotely in this way to be useful. For instance, in cases where the repos are extremely large (approaching 20GB of source files in this case).

Even using SourceTree with a sparse checked out cloned repo of this size on Windows is painfully slow. On the other hand running the same git commands (like git pull) remotely on the non-sparse repo is much faster, and would actually make SourceTree respond faster if it was possible to configure it this way. We are talking \~5 minutes on Windows vs less than a minute on Linux to run git pull for the same repo, each pointing to the same remote. And the Windows repo is sparse AND on an SSD no less!

I have followed all git optimization tricks on Windows I could find, and while they do help, doing a git pull still takes \~5 minutes.

To put this another way, on Windows instead of running:

\> git status

...I can run the following:

\> plink user@host "cd /path/to/repo; git status"

So if one was able to configure SourceTree to run the git commands that way as well, now you can have a remote git GUI that was more responsive than using a repo cloned locally (in some cases at least, definitely true in my case). The only thing is that commands like "Show in Explorer" or resolving conflicts etc would need to be aware of the fact that it is working with a remote repo. So SourceTree would either need to copy those files locally for those operations (and copy back afterwards if needed), or take a path to where the remote repo is mounted locally as a share.

So while you mention that SourceTree is optimized for local repos, I find it interesting that my suggestion would actually make SourceTree faster for cases like mine, not slower.


Tags: git

windows