在 sshfs 上使用 git 太慢
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7245837/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using git over sshfs is too slow
提问by banyan
I'm using git over sshfs (under Mac OS X 10,5, 10.7) but it's too slow.
我在 sshfs 上使用 git(在 Mac OS X 10,5、10.7 下)但它太慢了。
Everytime I logged in remote server direcly, to use git command.
每次我直接登录远程服务器时,都要使用 git 命令。
I tried this post, http://kerneltrap.org/mailarchive/git/2008/10/23/3768494however it doesn't work.
我试过这篇文章,http://kerneltrap.org/mailarchive/git/2008/10/23/3768494但是它不起作用。
Does anyone know any good ideas?
有谁知道任何好主意?
回答by Agoston Horvath
You could pick some other filesystem. SSHFS is mainly a convenience tool. MacOS support NFS mounts, for example, and that is fast.
您可以选择其他一些文件系统。SSHFS 主要是一个方便的工具。例如,MacOS 支持 NFS 挂载,而且速度很快。
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.
另一种方法是使用 rsync 或 unison(“双向 rsync”工具)。这些确实可以在远程和本地文件系统之间快速同步。再加上一些用于远程编译/运行的快速 shell 别名,这是一个很好的解决方法。
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.
另一种方法是通过 VNC/X11 远程运行您的开发环境。这会使 IDE 变得有些迟钝,但不需要同步代码。
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.
以上方法的混合是制作删除服务器的虚拟机克隆,在本地机器上运行它,并通过虚拟机或两者之间的一些本地 NFS 共享文件夹。
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.
您还可以调整 sshfs。有一些调整挂载选项,您还可以关闭加密。它总体上提供了大约 2 倍的加速,所以不要指望奇迹。
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.
与海报一样,我多年来一直在寻找解决方案,但没有这样做,我不高兴地使用微调的 sshfs,加上偶尔的 rsyncs 和耐心。
回答by o_O
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.
我知道这已经很老了,但我每天都会遇到这个问题。我有一个非常复杂的环境,在本地重新创建几乎是不可能/冗长的。我们到处都有东西,并使用 3rd 方 API、cPanel API 等。
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.
唯一对我有用的解决方案是通过 sshfs 在本地挂载和处理文件,但是当需要 git 时,我打开了一个终端窗口,它只是 ssh 进入,这对我有用。您是否有理由不能/不想打开终端?否则,这似乎是最快的解决方案,对我来说也是最可靠的。
回答by Luke404
If I understood it correctly you're directly accessing the git repository over sshfs.
如果我理解正确,您将通过 sshfs 直接访问 git 存储库。
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 的全部意义在于分发并能够推/拉,那么为什么不将 repo 克隆到本地 fs 呢?请记住,git clone 也可以从文件系统运行,您不需要从“联网”(ssh、http、git 等)存储库进行克隆。
$ git clone /my_sshfs_mountpoint/repo
and you're ready to rock. Just remember to git push
back your work when you're done.
你准备好摇滚了。请记住git push
在完成后支持您的工作。