Git repository to a VirtualBox guest via sshfs

The host has a git repository /home/meisterluk/repo and has VirtualBox running a UNIX operating system. We want to provide the git repository as read-only folder to the guest. Test system as host and guest was xubuntu 14.04.

  1. Install openssh-server on your host system. ps aux | grep sshd should return one line mentioning the running ssh daemon afterwards.
  2. Install sshfs in your guest operating system.
  3. Change VirtualBox’s Configuration > Network > Adapter 1 from Attached to: NAT to Attached to: Bridged Adapter. Name: wlan0 works for me because I am using the wlan0 device to connect to the internet.
  4. Ask for the ip address of your host network device via ip a. For me this is
  5. Run

    sshfs [host operating system username]@[IP address]:[repository path on host system] [mount point] -o allow_other,uid=33,gid=33
    actually: sshfs meisterluk@ /var/www/html/repo -o allow_other,uid=33,gid=33

    where 33 is the uid and gid of the user www-data. In order to set allow_other I had to uncomment the line user_allow_other in /etc/fuse.conf.

If you savestate the VirtualBox instance and continue again, you need to remount it again (because apparently the SSH session stopped). You can always umount the sshfs using sudo fusermount -u /var/www/html/repo.

Credits go to LSPE for his hints. Thanks!

Git repository to a VirtualBox guest via sshfs