threads / discuss / 16018

Tip: avoiding net overhead using git over sshfs

Subject: Tip: avoiding net overhead using git over sshfs

## tl;dr

5 messages between Oct 23, 2008 and Oct 23, 2008.

replies: 4people: 4as markdown or json

Felipe Carvalho Oliveira· Oct 23, 2008, 01:26 UTC · lore

Use git over sshfs is not so good, but is an option for people that don't have shell acess to the server/hosting like me.

# mounting sshfs -o workaround=rename <user>@<host>:/home/<user>/ <mount_point> cd <the_directory_of_your_project>

# we will move the .git directory to the local filesystem mv .git ~/.my_project_git # and create a symlink to the local .git ln -s ~/.my_project_git .git

Done!

Now you can open gitk instantly ;-) and don't need to have the entire .git thing on a remote filesystem.

         Felipe (from Brazil, my english skills aren't so good :-)
Michael J Gruber· Oct 23, 2008, 08:32 UTC · re: Felipe Carvalho Oliveira · lore

Re: Tip: avoiding net overhead using git over sshfs

Felipe Carvalho Oliveira venit, vidit, dixit 23.10.2008 03:26:
> Use git over sshfs is not so good, but is an option for people that
> don't have shell acess to the server/hosting like me.

I'm sorry but I'm afraid I'm missing the point: If you don't have shell access then you can't use ssh(fs), can you? Maybe you mean you can't set up git daemon or gitweb.cgi on the server?

Show 13 quoted lines
> # mounting
> sshfs -o workaround=rename <user>@<host>:/home/<user>/  <mount_point>
> cd <the_directory_of_your_project>
> 
> # we will move the .git directory to the local filesystem
> mv .git ~/.my_project_git
> # and create a symlink to the local .git
> ln -s ~/.my_project_git .git
> 
> Done!
> 
> Now you can open gitk instantly ;-) and don't need to have the entire
> .git thing on a remote filesystem.

In fact your complete git repository is now on the local filesystem, with only the worktree checked out on sshfs. Is that what you are trying to achieve? Or do you want to "synchronize" repos on local and sshfs filesystems?

Michael
Felipe Carvalho Oliveira· Oct 23, 2008, 11:51 UTC · re: Michael J Gruber · lore

Re: Tip: avoiding net overhead using git over sshfs

On Thu, Oct 23, 2008 at 6:32 AM, Michael J Gruber <git@drmicha.warpmail.net> wrote:

> I'm sorry but I'm afraid I'm missing the point: If you don't have shell
> access then you can't use ssh(fs), can you?
> Maybe you mean you can't set up git daemon or gitweb.cgi on the server?

Yes, i can't set up any git daemon or any other software. I have just sftp acess. And sftp is a "dumb protocol" to use git.

On Thu, Oct 23, 2008 at 7:00 AM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
> I think you'd better work locally, and push to the sshfs directory
> from time to time. Then, you'd both have working tree and .git locally
> and fast, while keeping the safety of replicating to your ssh server.

I can't use git-push as I explained before. I use git as a deployment tool in this case. I work locallly and use git-pull to sync my local repo and the "production"(server). Git works better than a manual (S)FTP sync.

I hope I'm more clear now.

-- Felipe

Johannes Sixt· Oct 23, 2008, 12:54 UTC · re: Felipe Carvalho Oliveira · lore

Re: Tip: avoiding net overhead using git over sshfs

Felipe Carvalho Oliveira schrieb:
Show 10 quoted lines
> On Thu, Oct 23, 2008 at 7:00 AM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
>> I think you'd better work locally, and push to the sshfs directory
>> from time to time. Then, you'd both have working tree and .git locally
>> and fast, while keeping the safety of replicating to your ssh server.
> 
> I can't use git-push as I explained before.
> I use git as a deployment tool in this case.
> I work locallly and use git-pull to sync my local repo and the
> "production"(server).
> Git works better than a manual (S)FTP sync.

Then how about this: You keep your repository local, and you also hack locally. When it's time to push your changes to the production server, you do this:

  $ GIT_INDEX_FILE=.git/index.published \
    GIT_WORK_TREE=/sshfs-mount/on/production/server \
    git reset --hard
This will update only files that changed since you did this the last time.
Disclaimer: I didn't try this myself.
-- Hannes
Matthieu Moy· Oct 23, 2008, 09:00 UTC · re: Felipe Carvalho Oliveira · lore

Re: Tip: avoiding net overhead using git over sshfs

"Felipe Carvalho Oliveira" <felipekde@gmail.com> writes:
Show 11 quoted lines
> Use git over sshfs is not so good, but is an option for people that
> don't have shell acess to the server/hosting like me.
>
> # mounting
> sshfs -o workaround=rename <user>@<host>:/home/<user>/  <mount_point>
> cd <the_directory_of_your_project>
>
> # we will move the .git directory to the local filesystem
> mv .git ~/.my_project_git
> # and create a symlink to the local .git
> ln -s ~/.my_project_git .git

I think you'd better work locally, and push to the sshfs directory from time to time. Then, you'd both have working tree and .git locally and fast, while keeping the safety of replicating to your ssh server.

-- 
Matthieu

← back to recent threads