Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error linking git to homebrew [duplicate]

I'm following Luke Jones' article on setting up a local server, and I'm currently trying to set up homebrew with git on Mavericks. I already had git installed before installing homebrew. I'm having an issue that seemed similar to this question but when I tried running brew link git I received the following error:

Error: Could not symlink file: /usr/local/Cellar/git/1.8.5.1/share/git-core/templates/info/exclude
Target /usr/local/share/git-core/templates/info/exclude already exists. You may need to delete it.
To force the link and overwrite all other conflicting files, do:
  brew link --overwrite formula_name

To list all files that would be deleted:
  brew link --overwrite --dry-run formula_name

My /etc/paths:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

which git returns /usr/bin/git

which brew returns /usr/local/bin/brew

Not sure what the issue is, as I'm still not great at finding my way around things like this. Anyone know next steps to take?

like image 617
stvnrynlds Avatar asked Dec 18 '13 01:12

stvnrynlds


2 Answers

For others having an issue in the future:

I have git linked with homebrew now. I had the Mac Github client installed which may have been making some files unwriteable (this post tipped me off), so I uninstalled that with AppCleaner, restarted my terminal, uninstalled all versions of git, ran sudo brew prune to clean things up, and reinstalled git through brew with brew install git. Then I ran brew link git and it worked just fine.

I'm sure someone else might have a better explanation of what happened, and some of these steps might have been overkill, but it worked for me!

like image 112
stvnrynlds Avatar answered Nov 06 '22 05:11

stvnrynlds


Try overriding the links as suggested in the error message:

 brew link --overwrite git

You may add --dry-run to check it first before doing any changes.

like image 9
kenorb Avatar answered Nov 06 '22 03:11

kenorb