How to install and use Gitfs

Here are the required steps to install and use Gitfs on your machine.


  1. Ubuntu 18.04, 19.04 and 19.10 are fully supported for now.
sudo add-apt-repository ppa:presslabs/gitfs
sudo apt-get update
sudo apt-get install gitfs
  1. For using gitfs on Mac, the steps are as follows:


brew install gitfs
  1. Debian and Raspbian
sudo echo "deb disco main" > /etc/apt/sources.list.d/gitfs.list
sudo echo "deb-src disco main" >> /etc/apt/sources.list.d/gitfs.list
sudo apt update
sudo apt install gitfs


Before mounting, you’ll need a working git repository. You can use a local repository or maybe a git service like GitHub .

In order to mount your repository to the desired directory, use:

gitfs /mount/directory

Full github example

Consider the following setup:

  • apache2 running as www-data user/group
  • foo_user - your username at
  • boo_password - a password for your github’s account
  • - your project’s URL

Before mounting your repo, run once these two commands:

  • mkdir /var/lib/gitfs
  • mkdir /var/mount/whatever_dir

Now it’s time for test run:

gitfs -o log=/var/log/gitfs.log,debug=true,foreground=true,commiter_name=foo_user,,user=www-data,group=www-data,username=foo_user,password=boo_password /var/mount/whatever_dir

Open second terminal window and monitor the log file via command tail -f /var/log/gitfs.log. Play around with files in your dir and see how it reflects in your repository at github, make sure that it works in both directions. Use Ctrl-C to stop gitfs when you are done.

For production use the following arguments:

gitfs -o log=/var/log/gitfs.log,debug=false,foreground=false,log_level=warning,commiter_name=foo_user,,user=www-data,group=www-data,username=foo_user,password=boo_password /var/mount/whatever_dir

See Arguments for more details.

Directory structure

current/ – contains a snapshot of the commit that the branch’s HEAD is pointing to. Any changes made here will be automatically committed and pushed to the repository you have mounted.

history/ – contains a series of directories whose names are dates. In these directories you will find each commit’s read-only snapshot categorized by the time and SHA of that commit. Every snapshot will be read-only.

The history folder can look like this:


The inner folders are the snapshots of their respective commits.

Keeping things up to date

gitfs automatically fetches the newest changes from your repository at a given time interval. The default delay between fetches is 30s but you can change this value with the fetch_delay argument. See Arguments for more details.

The inner folders are the snapshots of their respective commits.