Created
January 11, 2011 10:25
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() |
Thanks, maybe one day xcode will update their git..
The version of Git that comes with Xcode is fairly recent. This script is just for those who want to use the development builds of Git.
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
Just a small note : caius' script does the contrary of the python script.
If you want to update git and use it as default, FROM_DIR and TO_DIR should be exchanged in the zsh script.