Skip to content

Instantly share code, notes, and snippets.

@Abizern
Created January 11, 2011 10:25
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Abizern/774277 to your computer and use it in GitHub Desktop.
Save Abizern/774277 to your computer and use it in GitHub Desktop.
Replace a Git installation in /usr/bin/ with symlinks to a preferred git installation.
#!/usr/bin/env python -tt
"""Xcode4 installs and expects to find a git installation at /usr/bin.
This is a pain if you want to control your own installation of git that
might be installed elsewhere. This script replaces the git files in
/usr/bin with symlinks to the preferred installation.
Update the 'src_directory' to the location of your preferred git installation.
"""
import sys
import os
#- Configuration -----------------------------------------------------------------
src_directory = '/usr/local/git/bin/' # preferred installation
#----------------------------------------------------------------------------------
dest_directory = '/usr/bin/'
files = ('git','git-cvsserver','git-receive-pack','git-shell','git-upload-archive','git-upload-pack','gitk')
def main():
if os.getuid():
print "This script needs to be run as 'sudo python update_git.py'"
sys.exit(1)
for a_file in files:
src_file = os.path.join(src_directory, a_file)
dest_file = os.path.join(dest_directory, a_file)
if os.path.exists(dest_file):
os.remove(dest_file)
os.symlink(src_file, dest_file)
if __name__ == '__main__':
main()
@gsanjeevkumar
Copy link

Can any one help me. I am setting up my local development environment. I have a server (MAC OS X Lion Server) and want that to house git and use the repository over http. I followed all the steps from http://www.pkgbox.org/wordpress/2011/08/setting-up-a-git-server-on-macos-x-lion/ but now I get fatal: http:/myname@server/repo/test-project.git/info/refs not found did you run git update-server-info on the server? Please help i am running out on time... I want to use git and start this project...

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