27

I'm using git over sshfs (under Mac OS X 10,5, 10.7) but it's too slow.

Everytime I logged in remote server direcly, to use git command.

I tried this post, http://kerneltrap.org/mailarchive/git/2008/10/23/3768494 however it doesn't work.

Does anyone know any good ideas?

banyan
  • 2,881
  • 2
  • 22
  • 20
  • 3
    Why not just clone the repo to your local machine? – Alex Howansky Aug 30 '11 at 15:47
  • 3
    Thanx comment! Yes, of course It's possible to clone to my local machine. But the remote server has very complicated enviroment, and it's really hard to make it every local machine. so sshfs is everything fine but the only `git command` is a problem. – banyan Aug 31 '11 at 08:32
  • i have similar issue, but i tried to use appletalk (also from a mac). but i've lots of strange issues, with this setup ... :(. i too thought about rsync synchronization ... have you found a solution for your problem? if so i would be more than happy, if you would share it. – aurora Jan 18 '12 at 16:50
  • I have a similar issue also, the filesystem I'm using over sshfs is a staging server which connects to a database, in order to run it locally I'd have to run that database locally at least, and probably do a lot of configuring of Perl (the backend) and who knows what else... ssh-ing in and running git on the remote machine works fine, but what I want is to see the diff output graphically in Meld or similar... – drkvogel Aug 23 '18 at 22:21
  • I know it's been a while since your post, but did you find a better approach than the proposed on the current answers? – alan.elkin Mar 09 '20 at 19:35
  • @alan.elkin does [sshfs 3.7](https://github.com/libfuse/sshfs/releases/tag/sshfs-3.7.0) help the situation in your case? – Fuseteam Mar 11 '21 at 16:28

3 Answers3

24

You could pick some other filesystem. SSHFS is mainly a convenience tool. MacOS support NFS mounts, for example, and that is fast.

Another way to go ahead would be to use rsync or unison ('two-way rsync' tool). These do really quick sync between the remote and local filesystem. Coupled with some quick shell aliases for compiling/running remotely, it is a nice workaround.

Another way would be to run your development environment remotely over VNC/X11. This makes the IDE somewhat more sluggish, but the code doesn't need to be synced.

A mix of the above is to make a Virtual machine clone of the remove server, run it on your local box, and share folders via the VM or some local NFS between the two.

You could also tweak sshfs. There are some tuning mount options, and you can also turn off encryption. It gives roughly 2x speedup overall, so don't expect wonders.

Being in the same shoes as the poster, I've looked for solutions for years, but failing to do so, I've unhappily settled with fine-tuned sshfs, coupled with occasional rsyncs, and patience.

Agoston Horvath
  • 763
  • 6
  • 13
  • Thanks user493759 giving me quite convincing answer. I've never known such as two-way rsync tool, and sshfs's encryption as well. I'll try both of these. – banyan Sep 02 '11 at 03:43
  • 2
    Any idea in particular why git is so slow? Everything else seems to be fine, but `git status` is unbearable. – Ceasar Bautista Dec 10 '12 at 17:39
  • 8
    Ceasar: because git status compares all the checked out files with the repo to see if there were changes. That is A LOT of small IO, which is what sshfs is really bad at because of the high latency. – Agoston Horvath Dec 13 '12 at 21:52
  • the bottleneck of sshfs may be resolved in [sshfs3.7](https://github.com/libfuse/sshfs/releases/tag/sshfs-3.7.0) – Fuseteam Mar 11 '21 at 16:27
9

I know this is very old but I run into this problem daily. I have a very complicated environment that would be virtually impossible/lengthy to recreate locally. We have things everywhere and working with 3rd party APIs cPanel APIs etc.

The only solution that works for me is to mount and work on the files locally over sshfs but when it's time to git I have a terminal window open that's just ssh'd in and this works for me. Is there a reason you can't/don't want to have a terminal open? Otherwise that seems to be the fastest solution and most reliable to me.

o_O
  • 4,862
  • 11
  • 46
  • 84
  • That's also how I do it. The only thing I do in the `sshfs` mount point is `pull`. All the rest I do in a separate `ssh` session, so that the target local git runs the command, not the local host git on the target's file system. – Gauthier Mar 17 '15 at 14:20
  • Not the OP, but my reason for not doing it this way is that I much prefer Emacs' magit mode to cherry pick patches to commit, over using the command line tool. – Ketil Malde May 16 '20 at 16:41
  • this problem may now be solved with [sshfs 3.7](https://github.com/libfuse/sshfs/releases/tag/sshfs-3.7.0) – Fuseteam Mar 11 '21 at 16:23
0

If I understood it correctly you're directly accessing the git repository over sshfs.

The whole point of git is being distributed and be able to push/pull around, so why don't you just clone the repo to the local fs? Remember that git clone works from a filesystem too, you don't need to clone from a "networked" (ssh, http, git, etc...) repository.

$ git clone /my_sshfs_mountpoint/repo

and you're ready to rock. Just remember to git push back your work when you're done.

Luke404
  • 9,004
  • 3
  • 22
  • 31
  • 2
    As I told above, it's possible to clone to my local machine. But the remote server has very complicated enviroment, and it's really hard to make it every local machine. so sshfs is everything fine but the only git command speed is a problem. Thanks. – banyan Aug 31 '11 at 08:37
  • If you can sshfs-mount you can also run git clone - I can't understand where the problem is. Anyway, that is the solutions to your speed problems, so you must use one of the two: clone or patience. – Luke404 Aug 31 '11 at 16:09
  • @kyanny I still think you're misusing git. It's a distributed system and you insist in using it "locally" (mounting the remote fs with sshfs and then running git over that): it's no surprise it doesn't work well.When/where your edits appear is another story, git is only related to version control. If you want "instant remote edits", then edit over sshfs and after that run git on the remote system (not locally on sshfs). – Luke404 Jun 28 '12 at 10:34
  • I use git over sshfs because there is no git on the server. – gerrit May 15 '15 at 09:27
  • 2
    Even if there WERE git on the server, you may want to run a nice client on your local machine =] – Relequestual Jan 22 '16 at 13:58
  • 1
    @gerrit you have a git repository on the server but no git client? and you can't either install git on the server or clone the repo locally? – ealfonso Dec 06 '18 at 20:09
  • @ealfonso I don't remember, it was more than 3 years ago. – gerrit Dec 06 '18 at 21:47