Skip to content

Instantly share code, notes, and snippets.

@alghanmi
Forked from ad510/install_git_on_parallel.sh
Created April 25, 2012 07:24
Show Gist options
  • Save alghanmi/2487716 to your computer and use it in GitHub Desktop.
Save alghanmi/2487716 to your computer and use it in GitHub Desktop.
shell script to install Git on USC parallel computers without root permissions
# note that this file needs execute permissions to run, which can be done by running "chmod u+rwx ./install_git_on_parallel.sh" (without quotes)
# this script based on:
# http://joemaller.com/908/how-to-install-git-on-a-shared-host/
# http://stackoverflow.com/questions/9500898/compiler-error-msgfmt-command-not-found-when-compiling-git-on-a-shared-hosting
# update $PATH
echo "# the following two lines added by install_git_on_parallel.sh" >> ~/.bashrc
echo "export PATH=$HOME/opt/bin:$PATH" >> ~/.bashrc
echo ". $HOME/opt/contrib/completion/git-completion.bash" >> ~/.bashrc
. ~/.bashrc
# make temporary source directory
mkdir ~/git_src
# compile zlib
cd ~/git_src
wget http://zlib.net/zlib-1.2.6.tar.gz
tar -xvzf zlib-1.2.6.tar.gz
rm ./zlib-1.2.6.tar.gz
cd ./zlib-1.2.6
./configure --prefix=$HOME/opt
make && make install
# compile git
cd ~/git_src
wget https://git-core.googlecode.com/files/git-1.7.10.tar.gz
tar -xvzf git-1.7.10.tar.gz
rm ./git-1.7.10.tar.gz
cd ./git-1.7.10
./configure --prefix=$HOME/opt --with-zlib=$HOME/opt --without-tcltk
make -i
make install -i
# add bash completion
mv contrib/ $HOME/opt/
# clean up source directories
cd ~
rm -rf ~/git_src/zlib-1.2.6
rm -rf ~/git_src/git-1.7.10
rmdir ~/git_src
echo "NOW LOG OUT AND LOG BACK IN, THEN YOU CAN USE GIT!"
@alghanmi
Copy link
Author

Added Feature

  • Included all the contrib scripts from the git source in the installation directory
  • Add bash completion for git through a git contrib script.

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