I suggest uninstalling homebrew
and then reinstalling it and your packages following this guide.
Although this would seem to be more tedious than fixing the PATH to git
, a clean uninstall/reinstall is guaranteed to end with a sound build.
You currently have a homebrew
installation that was built on a different architecture from where isit sits. The issues begins with the PATH order as noted by @Allan and @bmike.