Skip to content

Instantly share code, notes, and snippets.

@momirjalili
Forked from Problematic/install_pygit.sh
Last active December 21, 2015 06:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save momirjalili/6262471 to your computer and use it in GitHub Desktop.
Save momirjalili/6262471 to your computer and use it in GitHub Desktop.
# this will install everything as root, so take that into account before you run it
# need cmake, python development headers, ZLib and OpenSSL
sudo apt-get install cmake python2.7-dev zlib1g-dev libssl-dev
mkdir libgit && cd libgit
git clone git://github.com/libgit2/libgit2.git
cd libgit2
# instructions from http://libgit2.github.com/#install
mkdir build && cd build
cmake ..
cmake --build .
sudo cmake --build . --target install
cd ../../
# instructions from https://github.com/libgit2/pygit2/blob/master/README.rst
git clone git://github.com/libgit2/pygit2.git
cd pygit2
sudo python setup.py install
# avoid "cannot open shared object file" ImportErrors; make sure the libraries are accessible in LD_LIBRARY_PATH
# if you want a more permanent solution, try echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH` >> ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
sudo ldconfig
ldconfig -p | grep libgit
# clean up after ourselves
cd ../../
rm -rf libgit/
# now, from the python interpreter:
# >>> from pygit2 import Repository
# if you don't get any errors, you're done!
@ifduyue
Copy link

ifduyue commented May 28, 2014

It'd be better to use master branch:
git clone -b master --depth 1 git://github.com/libgit2/libgit2.git

By default it's development branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment