Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im following the tutorial below to install git.

https://help.github.com/articles/set-up-git

However when I get to the end where I need to install the helper into the same directory where Git itself is installed i get the following error:

Davids-iMac:~ davidcavanagh$ which git
/usr/bin/git
Davids-iMac:~ davidcavanagh$ sudo mv git-credential-osxkeychain /usr/bin
mv: rename git-credential-osxkeychain to /usr/bin/git-credential-osxkeychain: No such file     
or directory
Davids-iMac:~ davidcavanagh$ 

Edit: I am now getting the following error when I install git and then run git -version

Davids-iMac:~ davidcavanagh$ git -version
/usr/bin/git: line 1: syntax error near unexpected token `newline'
/usr/bin/git: line 1: `<?xml version="1.0" encoding="UTF-8"?>'
I was following this tutorial guide:https://help.github.com/articles/set-up-git

I have also tried using home-brew as well and I get the following error when I do this:

Davids-iMac:~ davidcavanagh$ ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> Downloading and Installing Homebrew...
Failed during: git init -q

Can anyone help? Thanks

share|improve this question

migrated from stackoverflow.com Nov 14 '12 at 14:27

This question came from our site for professional and enthusiast programmers.

You need to download the program, as it says in the guide a few lines above the code you are having a problem with.

git credential-osxkeychain # Test for the cred helper
# git: 'credential-osxkeychain' is not a git command. See 'git --help'.

curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain # Download the helper

chmod u+x git-credential-osxkeychain # Fix the permissions on the file so it can be run
share|improve this answer
    
Thanks I did that but now im getting an error at the very end why I try and execute git config --global credential.helper osxkeychain Davids-iMac:~ davidcavanagh$ git config --global credential.helper osxkeychain /usr/bin/git: line 1: syntax error near unexpected token newline' /usr/bin/git: line 1: <?xml version="1.0" encoding="UTF-8"?>' Any ideas? – davemc Nov 14 '12 at 14:35
    
It seems you have downloaded something else, probably an error page. Download the file github-media-downloads.s3.amazonaws.com/osx/… and try again. – Joakim Nohlgård Nov 14 '12 at 14:45

On OSX use Homebrew to install git. Once you've installed homebrew with its simple one-liner command, then type these commands:

brew update
brew install git
share|improve this answer
    
When I try and use homebrew I get: Failed during: git init -q – davemc Nov 14 '12 at 14:46
up vote 0 down vote accepted

After trying everything I solved this problem by updating the Command Line Tools with Xcode. This can be done here: https://developer.apple.com/downloads/index.action# or by going to Xcode--->Preferences----->Downloads

share|improve this answer
  1. Download Git Installer – The download is titled “Snow Leopard,” but the package works fine with both Lion and Mountain Lion.

  2. Open Mac’s “System Preferences” and select “Security & Privacy”

  3. Under “Allow applications downloaded from,” make sure “Anywhere” is selected

  4. Open DMG downloaded in Step 1 and install the package.

  5. Open your terminal and run the following:

    sudo mkdir -p /usr/local/bin
    sudo ln -s /usr/local/git/bin/git /usr/local/bin/git
    exit
    
  6. Re-open your terminal and run the following:

    git –-version
    

    usage: git [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [-c name=value] [--help] []

  7. You’re good to go...

share|improve this answer
1  
Still getting that error after I have followed all those steps!Davids-iMac:~ davidcavanagh$ git -version /usr/bin/git: line 1: syntax error near unexpected token newline' /usr/bin/git: line 1: <?xml version="1.0" encoding="UTF-8"?>' – davemc Nov 14 '12 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .