How to fix GitKraken Inotify Limit Error - upgrading Ubuntu/Linux inotify limits
By: +David Herron; Date: February 7, 2018
GitKraken is a totally excellent Git client. If you're a software developer you should absolutely give GitKraken a try. Today I went to do some commits in one of my repositories but GitKraken told me it had gotten an Inotify Limit Error, and that I needed to increase this limit. Turns out the issue has nothing to do with GitKraken, and is also fairly easy to fix.
Upon opening the repository in question, GitKraken showed a notification window with this message:
Inotify Limit Error File watching is disabled for this repository. Please increase your inotify limit and reopen this repository.
Previously in the day GitKraken gave a message while opening the same repository that it didn't find a "Compatible Repository" and it refused to even open the repository. Thing is, the repository is fine, and I used git to do my commits without problem. It's possible the Inotify Limit made some kind of impact on GitKraken causing GitKraken to say it could not find a compatible repository. I've sent the GitKraken team a query and haven't received a reply.
An important detail is that I'm on Ubuntu 17.10. I've been using Mac OS X for many years, and recently setup this Ubuntu machine to see how well any kind of Linux would work for me. For what it's worth GitKraken is working the same on both, thanks to the portability coming from it being an Electron-based application.
What is Inotify?
Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes to applications.
One major use is in desktop search utilities like Beagle, where its functionality permits reindexing of changed files without scanning the filesystem for changes every few minutes, which would be very inefficient.
Since GitKraken automagically notices changes in files in a workspace, it obviously must be using this subsystem on Linux. Since I'm using Ubuntu, this applies to me.
Type this command:
$ cat 8192sys inotify/max_user_watches
This is the limit on your computer.
Each inotify watch consumes a modest amount of memory. On a 64-bit computer like this one, each consumes 1 KB, so 8,192 watches consumes about 8 MB of memory. On a 16GB main memory computer that's a drop in the bucket.
Temporarily increasing the limit is this simple:
echo 99999 > /proc/sys/fs/inotify/max_user_watches
After which you'll get this:
$ cat 99999sys inotify/max_user_watches
To make a permanent change, set
fs.inotify.max_user_watches= in sysctl settings. On some systems (Debian/Ubuntu/etc) those settings are in
/etc/sysctl.conf and on some others there will be a file in
After editing the sysctl settings, run this:
# sysctl -p fs.inotify.max_user_watches = 99999
Putting it on one line:
echo fs.inotify.max_user_watches=99999 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Or on certain other systems:
# echo fs.inotify.max_user_watches=99999 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system