Skip to content

Instantly share code, notes, and snippets.

@ah-cog
Forked from bendavis78/gist:3157948
Last active October 1, 2017 00:21
Show Gist options
  • Save ah-cog/77ade8ed537024fbf89a7e904ff6790d to your computer and use it in GitHub Desktop.
Save ah-cog/77ade8ed537024fbf89a7e904ff6790d to your computer and use it in GitHub Desktop.
Installing pygit2 on Ubuntu 16.04

Download and build libgit2

cd ~/.local/src/
git clone git://github.com/libgit2/libgit2.git 
cd libgit2
mkdir build && cd build
cmake ..
cmake --build .

If debugging, use the following cmake commands instead:

cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build .

Install libgit2

sudo cmake --build . --target install

This will install libgit2 in /usr/local. In my case, libgit2's install command did not call ldconfig, so I had to do it manually:

sudo ldconfig

Confirm that libgit2 can be found:

ldconfig -p | grep libgit

This should output the paths to libgit2.so.0 and libgit2.so.

At this point, you should be able to install pygit2.

Install pygit2

sudo -H pip install pygit2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment