问题
I am running a git repository on a remote server. I have it set up a samba share on the remote server so I can save my code there instead of on my local windows 7 machine. We are trying to look into using git, because svn has been so slow and unreliable. The problem that we are having with git is that doing any commits/clones/pulls onto the samba share run super super slow. If i do a commit/clone/pull onto a local dir on my windows 7 machine it works great, but we need the code to be on the remote server. Any ideas? I could really use it.
Edit:
I should also mention that I have already ran git gc --aggressive and it hasn't sped it up.
回答1:
Git is not meant to be used in this configuration. It's like getting a Formula 1 and have it race on a dirt road.
Git is a DVCS, or distributed version control. In other words, every developer gets a clone.
What you need to do is setup a git server repository on that samba machine and access the repo via http or ssh
You can use projects like GitBlit or even better an account on Github
回答2:
I had the same problem with Git's performance over SMB shares. Unfortunately I can't run the development code on my local machine, so I use SMB to mount the remote directory and edit the source files using a proper text editor on my local machine.
Since I want some comfort when committing to the repository, I prefer a GUI client which runs on my local machine. With the mentioned performance problems this is a bit tricky, though, and takes a lot of time.
However: I found a sleek little workaround. Before committing anything to the repository, I pull a copy of the remote sources to my local hard drive using rsync
, like this:
rsync -az --progress --exclude ".git" dev@my.devserver.com:/home/myapp/sourcecode /Devel/portal-mirror
That way it takes less than a second to do a full 1-to-1 sync of the remote state (bound this to a keyboard shortcut in my Git app) before doing the diffs and commits. Works like a charm. After committing and pushing to the repository I just do git reset --hard
and git pull
on the dev server to sync the changes back.
回答3:
We are running the same configuration with git and samba in combination with php-storm. Its running quite well. Only when i try to use "SourceTree" on our huge project it takes ages to refresh, because (i think) git scanns each and every single file to do so.
One thing i tried, and i got minor performance improvements out of it, was to tune the samba server a little bit:
Config File:
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
Found that line when looking for samba speedup.
Another solution might be a constant 1 on 1 sync which runs all the time in background kindof replacing samba. Maybe the rsync could be modified somewhat to do so.
回答4:
You might consider reversing the paradigm a bit and having the web server mount shares on the developers' machines. That way all the cloning/committing/coding is done locally, but each developer's site is simply hosted off of a share.
Right now I assume your webserver is exposing each website's root directory as a samba share. A developer then mounts that share on his or her local machine, clones some repository, and works off of the share. Performance in that case is going to be poor at best, and you may also run into problems with byte range locking requests (BRL) and such.
Instead, an option is to clone directly to a directory on each developer's computer, and share that directory. The web server then mounts that share.
Of course ideally each developer would run his or her own instance of the web server, but if I'm reading the questions correctly maybe that's not an option in this case.
来源:https://stackoverflow.com/questions/12095852/git-is-doing-very-slow-commits-on-a-samba-share-what-can-i-do-to-speed-it-up