Skip to content

Instantly share code, notes, and snippets.

@ifduyue
Forked from momirjalili/install_pygit.sh
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ifduyue/9fe14736d6d2f944692a to your computer and use it in GitHub Desktop.
Save ifduyue/9fe14736d6d2f944692a to your computer and use it in GitHub Desktop.
#!/bin/bash
# this will install everything as root, so take that into account before you run it
set -eu
# need cmake, python development headers, ZLib and OpenSSL
sudo apt-get install -y cmake python2.7-dev zlib1g-dev libssl-dev
root=`pwd`
git clone -b master --depth 1 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
# avoid "cannot open shared object file" ImportErrors
sudo ldconfig
ldconfig -p | grep libgit
sudo pip install pygit2 -U
# clean up after ourselves
cd $root
rm -rf libgit2
# now, from the python interpreter:
# >>> from pygit2 import Repository
# if you don't get any errors, you're done!
python -c 'from pygit2 import Repository' && echo 'pygit2 installed.' || echo 'failed to install pytgit2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment