Brew install git error

This is what I get when I try to install Homebrew: Error: Git is unavailable Downloading and installing Homebrew... Error: Git is unavailable It gives me an error and says that Git is unavailable,

Make sure that you have your brew updated.
First run the following command:

brew doctor

Now, if you get Your system is ready to brew, you can move on to install Git.

With Homebrew, installing Git is as easy as this:

brew update
brew install git

Note: it’s a good habit to run update before installing anything with Homebrew because Homebrew is updated regularly.

To verify:

git --version

You should get git version 2.3.1 or later.

Run brew doctor to make sure everything is still working.
In case brew doctor doesn’t work you can use these commands:

cd `brew --prefix`
git remote add origin https://github.com/Homebrew/homebrew.git
git fetch origin
git reset --hard origin/master
brew update

Already up-to-date.

If you’re seeing permission errors tried running

sudo chown -R $(whoami) $(brew --prefix)

Or if it complains that any directories inside /usr/local aren’t writable, fix it with this command:

sudo chown -R `whoami` /usr/local

Lastly, if you get Warning: /usr/bin occurs before /usr/local/bin, run the command below and quit and relaunch Terminal:

echo ‘export PATH=»/usr/local/bin:$PATH»‘ >> ~/.bash_profile

This command takes everything between the single quotes and adds it >> to a file called .bash_profile in your user’s root directory ~/. Every time you open a new Terminal window or tab, .bash_profile is called. The export PATH line tells your system to look in /usr/local/bin first, since that’s where Homebrew installs tools.

Download and Install the Command Line Tools

For El Capitan, Yosemite and Mavericks

  1. Inside the Terminal window, copy and paste (or type) the following command, and press the return key on your keyboard:

    xcode-select --install
    
  2. You should see the pop up below on your screen. Click Install when it appears.

install xcode

  1. Click Agree when the License Agreement appears.

  2. Your computer will then attempt to find the software, and then will start downloading it. The following popup will appear:

  3. Once the software is installed, click Done. That’s it! You’re now ready to go to Step 2.

install xcode, done

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

Bazookato opened this issue

Jun 25, 2016

· 20 comments

Comments

@Bazookato

Please follow the general troubleshooting steps first:

  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • If you’re seeing permission errors tried running sudo chown -R $(whoami) $(brew --prefix)?

You can erase any parts of this template not applicable to your Issue.

Bug reports:

Please replace this line with a brief summary of your issue AND if reporting a build issue include the link from:

brew gist-logs <formula>
(where <formula> is the name of the formula that failed to build).

Formula Requests:

Please note by far the quickest way to get a new formula into Homebrew is to file a Pull Request.

We will consider your request but it may be closed if it’s something we’re not actively planning to work on.

@Bazookato

macbookato:~ Katoo$ ruby -e «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)»
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/…
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew…

You must: brew install git
You must: brew install git
Error: Git is unavailable
Failed during: /usr/local/bin/brew tap homebrew/core
macbookato:~ Katoo$
macbookato:~ Katoo$ brew install wget
You must: brew install git
You must: brew install git
You must: brew install git
You must: brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
macbookato:~ Katoo$ brew update
You must: brew install git
You must: brew install git
Error: Git must be installed and in your PATH!
macbookato:~ Katoo$ brew update
You must: brew install git
You must: brew install git
Error: Git must be installed and in your PATH!
macbookato:~ Katoo$ brew doctor
You must: brew install git
You must: brew install git
You must: brew install git
You must: brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
macbookato:~ Katoo$ brew edit $FORMULA
You must: brew install git
You must: brew install git
Error: Changes will be lost!
The first time you brew update', all local changes will be lost, you should thusbrew update’ before you brew edit'! macbookato:~ Katoo$ rew gist-logs <formula> -bash: syntax error near unexpected tokennewline’
macbookato:~ Katoo$ brew install git
You must: brew install git
You must: brew install git
You must: brew install git
You must: brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
macbookato:~ Katoo$ brew doctor
You must: brew install git
You must: brew install git
You must: brew install git
You must: brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
macbookato:~ Katoo$

@bfontaine

@Bazookato Can you give us more information on your environment? Which version of OS X do you use?

@Bazookato

MacBookPro 2011 OS X 10.8.5

@Bazookato

I tried «brew install git» but won’t work

@blogabe

Did you xcode-select --install?

@ilovezfs

@ilovezfs

@MikeMcQuaid

@ilovezfs We should probably detect that a little nicer, though and perhaps offer to xcode-select --install.

@Bazookato

macbookato:~ Katoo$ xcode-select —install
xcode-select: Error: unknown command option ‘—install’.

xcode-select: Report or change the path to the active
Xcode installation for this machine.

Usage: xcode-select —print-path
Prints the path of the active Xcode folder
or: xcode-select —switch <xcode_path>
Sets the path for the active Xcode folder
or: xcode-select —version
Prints the version of xcode-select

macbookato:~ Katoo$

@Bazookato

@ilovezfs

That’s because --install does not exist on 10.8. You should just download Xcode.app (Version 5.1.1 (5B1008)) from Apple. The command line tools are only optional if you have Xcode.app, and they can be installed directly from Xcode 5.1.1 if you happen to want them.

@ilovezfs

@Bazookato

Guys, you are all very kind but I am lost as Alice in Wonderland. I actually landed here because Download Helper — Firefox Add-on — says I need to install a converter and linked me to your page:
http://www.downloadhelper.net/install-converter3.php

But I am a video editor and not a developer!!! ___

@Bazookato

And of course I can’t manage to install that little converter…

@ilovezfs

You don’t need to be a developer to use brew, but you would need to install Xcode 5.1.1 from Apple.

@tomck

@jmmk

I ran into this as well. I installed the CLI Tools and have git 1.8.5.2 (Apple Git-48) available on the system. Do I actually have to install the Xcode app? What’s different than just installing the CLI Tools?

@MikeMcQuaid

@jmmk That should be enough. Your bug is different if CLI Tools are installed. Can you open a new issue?

@jmmk

@MikeMcQuaid I ended up writing it off as a failed experiment and upgrading to El Capitan.

@MikeMcQuaid

@Homebrew
Homebrew

locked and limited conversation to collaborators

May 4, 2018

This is a list of commonly encountered problems, known issues, and their solutions.

  • Running brew
    • brew complains about absence of “Command Line Tools”
    • Ruby: bad interpreter: /usr/bin/ruby^M: no such file or directory
    • Ruby: bad interpreter: /usr/bin/ruby
    • brew update complains about untracked working tree files
    • launchctl refuses to load launchd plist files
    • brew upgrade errors out
    • Python: easy-install.pth cannot be linked
  • Installation fails with “unknown revision or path not in the working tree”
  • Upgrading macOS
  • Cask — cURL error
    • If the download works
    • If the download does not work
  • Cask — checksum does not match
  • Cask — permission denied
  • Cask — source is not there
  • Cask — wrong number of arguments
  • Other local issues

Running brew

brew complains about absence of “Command Line Tools”

You need to have the Xcode Command Line Utilities installed (and updated): run xcode-select --install in the terminal.

Ruby: bad interpreter: /usr/bin/ruby^M: no such file or directory

You cloned with git, and your Git configuration is set to use Windows line endings. See this page on configuring Git to handle line endings.

Ruby: bad interpreter: /usr/bin/ruby

You don’t have a /usr/bin/ruby or it is not executable. It’s not recommended to let this persist; you’d be surprised how many .apps, tools and scripts expect your macOS-provided files and directories to be unmodified since macOS was installed.

brew update complains about untracked working tree files

After running brew update, you receive a Git error warning about untracked files or local changes that would be overwritten by a checkout or merge, followed by a list of files inside your Homebrew installation.

This is caused by an old bug in in the update code that has long since been fixed. However, the nature of the bug requires that you do the following:

cd "$(brew --repository)"
git reset --hard FETCH_HEAD

If brew doctor still complains about uncommitted modifications, also run this command:

cd "$(brew --repository)/Library"
git clean -fd

launchctl refuses to load launchd plist files

When trying to load a plist file with launchctl, you receive an error that resembles either:

Bug: launchctl.c:2325 (23930):13: (dbfd = open(g_job_overrides_db_path, [...]
launch_msg(): Socket is not connected

or:

Could not open job overrides database at: /private/var/db/launchd.db/com.apple.launchd/overrides.plist: 13: Permission denied
launch_msg(): Socket is not connected

These are likely due to one of four issues:

  1. You are using iTerm. The solution is to use Terminal.app when interacting with launchctl.
  2. You are using a terminal multiplexer such as tmux or screen. You should interact with launchctl from a separate Terminal.app shell.
  3. You are attempting to run launchctl while logged in remotely. You should enable screen sharing on the remote machine and issue the command using Terminal.app running on that machine.
  4. You are su‘ed as a different user.

brew upgrade errors out

When running brew upgrade, you see something like this:

Error: undefined method `include?' for nil:NilClass
Please report this bug:
    https://docs.brew.sh/Troubleshooting
/usr/local/Library/Homebrew/formula.rb:393:in `canonical_name'
/usr/local/Library/Homebrew/formula.rb:425:in `factory'
/usr/local/Library/Contributions/examples/brew-upgrade.rb:7
/usr/local/Library/Contributions/examples/brew-upgrade.rb:7:in `map'
/usr/local/Library/Contributions/examples/brew-upgrade.rb:7
/usr/local/bin/brew:46:in `require'
/usr/local/bin/brew:46:in `require?'
/usr/local/bin/brew:79

This happens because an old version of the upgrade command is hanging around for some reason. The fix:

cd "$(brew --repository)/Library/Contributions/examples"
git clean -n # if this doesn't list anything that you want to keep, then
git clean -f # this will remove untracked files

Python: easy-install.pth cannot be linked

Warning: Could not link <formula>. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link <formula>'

Possible conflicting files are:
/usr/local/lib/python2.7/site-packages/site.py
/usr/local/lib/python2.7/site-packages/easy-install.pth
==> Could not symlink file: /homebrew/Cellar/<formula>/<version>/lib/python2.7/site-packages/site.py
Target /usr/local/lib/python2.7/site-packages/site.py 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

Don’t follow the advice here but fix by using
Language::Python.setup_install_args in the formula as described in
Python for Formula Authors.

Installation fails with “unknown revision or path not in the working tree”

When installing Homebrew, if the initial download fails with something like:

error: Not a valid ref: refs/remotes/origin/master
fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

or:

fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

This is an issue in the connection between your machine and GitHub, rather than a bug in Homebrew itself. See this discussion topic for a number of solutions others have found, such as using a wired connection or a VPN, or disabling network monitoring tools.

Upgrading macOS

Upgrading macOS can cause errors like the following:

  • dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.54.dylib
  • configure: error: Cannot find libz

Following a macOS upgrade it may be necessary to reinstall the Xcode Command Line Tools and then brew upgrade all installed formulae:

xcode-select --install
brew upgrade

Cask — cURL error

First, let’s tackle a common problem: do you have a .curlrc file? Check with ls -A ~ | grep .curlrc (if you get a result, the file exists). Those are a frequent cause of issues of this nature. Before anything else, remove that file and try again. If it now works, do not open an issue. Incompatible .curlrc configurations must be fixed on your side.

If, however, you do not have a .curlrc or removing it did not work, let’s see if the issue is upstream:

  1. Go to the vendor’s website (brew home <cask_name>).
  2. Find the download link for the app and click on it.

If the download works

The cask is outdated. Let’s fix it:

  1. Look around the app’s website and find out what the latest version is. It may be expressed in the URL used to download it.
  2. Take a look at the cask’s version (brew info <cask_name>) and verify it is indeed outdated. If the app’s version is :latest, it means the url itself is outdated. It will need to be changed to the new one.

Help us by submitting a fix. If you get stumped, open an issue explaining your steps so far and where you’re having trouble.

If the download does not work

The issue isn’t in any way related to Homebrew Cask, but with the vendor or your connection.

Start by diagnosing your connection (try to download other casks, or browse around the web). If the problem is with your connection, try a website like Ask Different to ask for advice.

If you’re sure the issue is not with your connection, contact the app’s vendor and let them know their link is down, so they can fix it.

Do not open an issue.

Cask — checksum does not match

First, check if the problem was with your download. Delete the downloaded file (its location will be pointed out in the error message) and try again.

If the problem persists, the cask must be outdated. It’ll likely need a new version, but it’s possible the version has remained the same (this happens occasionally when the vendor updates the app in-place).

  1. Go to the vendor’s website (brew home <cask_name>).
  2. Find out what the latest version is. It may be expressed in the URL used to download it.
  3. Take a look at the cask’s version (brew info <cask_name>) and verify it is indeed outdated. If so, it will need to be updated.

Help us by submitting a fix. If you get stumped, open an issue explaining your steps so far and where you’re having trouble.

Cask — permission denied

In this case, it’s likely your user account has no admin rights and therefore lacks permissions for writing to /Applications, which is the default install location. You can use --appdir to choose where to install your applications.

If --appdir doesn’t fix the issue or you do have write permissions to /Applications, verify you’re the owner of the Caskroom directory by running ls -dl "$(brew --prefix)/Caskroom" and checking the third field. If you are not the owner, fix it with sudo chown -R "$(whoami)" "$(brew --prefix)/Caskroom". If you are, the problem may lie in the app bundle itself.

Some app bundles don’t have certain permissions that are necessary for us to move them to the appropriate location. You may check such permissions with ls -ls '/path/to/application.app'. If you see something like dr-xr-xr-x at the start of the output, that may be the cause. To fix it, we need to change the app bundle’s permission to allow us to move it, and then set it back to what it was (in case the developer set those permissions deliberately). See litecoin.rb for an example of such a cask.

Help us by submitting a fix. If you get stumped, open an issue explaining your steps so far and where you’re having trouble.

Cask — source is not there

First, you need to identify which artifact is not being handled correctly anymore. It’s explicit in the error message: if it says It seems the App source…' then the problem is with the app stanza. This pattern is the same across all artifacts.

Fixing this error is typically easy, and requires only a bit of time on your part. Start by downloading the package for the cask: brew fetch <cask_name>. The last line of output will inform you of the location of the download. Navigate there and manually unpack it. As an example, let’s say the structure inside the archive is as follows:

.
├─ Files/SomeApp.app
├─ Files/script.sh
└─ README.md

Now, if we find this when looking at the cask with brew cat <cask_name>:

(…)
app "SomeApp.app"
(…)

The cask expects SomeApp.app to be in the top directory of the archive (see how it says simply SomeApp.app) but the developer has since moved it to be inside a Files directory. All we have to do is update that line of the cask to follow the new structure: app "Files/SomeApp.app".

Note that occasionally the app’s name changes completely (from SomeApp.app to OtherApp.app, let’s say). In these instances, the filename of the cask itself, as well as its token, must also change. Consult the token reference for complete instructions on the new name.

Help us by submitting a fix. If you get stumped, open an issue explaining your steps so far and where you’re having trouble.

Cask — wrong number of arguments

Make sure the issue really lies with your macOS version. To do so, try to install the software manually. If it is incompatible with your macOS version, it will tell you. In that case, there is nothing we can do to help you install the software, but we can add a depends_on macos: stanza to prevent the cask from being installed on incompatible macOS versions.

Help us by submitting a fix. If you get stumped, open an issue explaining your steps so far and where you’re having trouble.

Other local issues

If your Homebrew installation gets messed up (and fixing the issues found by brew doctor doesn’t solve the problem), reinstalling Homebrew may help to reset to a normal state. To easily reinstall Homebrew, use Homebrew Bundle to automatically restore your installed formulae and casks. To do so, run brew bundle dump, uninstall, reinstall and run brew bundle install.

Содержание

  1. cannot install on Mac OSX 10.8.5 ==> Downloading and installing Homebrew. You must: brew install git You must: brew install git Error: Git is unavailable #2385
  2. Comments
  3. Bug reports:
  4. brew update fails with «Git must be installed and in your PATH!» #3029
  5. Comments
  6. brandonsimpson / reinstall_git_brew.md
  7. Homebrew not finding newer git from $PATH #6274
  8. Comments
  9. What you were trying to do (and why)
  10. What happened (include command output)
  11. What you expected to happen
  12. Step-by-step reproduction instructions (by running brew commands)
  13. brew doctor
  14. brew config

cannot install on Mac OSX 10.8.5 ==> Downloading and installing Homebrew. You must: brew install git You must: brew install git Error: Git is unavailable #2385

  • Ran brew update and retried your prior step?
  • Ran brew doctor , fixed as many issues as possible and retried your prior step?
  • If you’re seeing permission errors tried running sudo chown -R $(whoami) $(brew —prefix) ?

You can erase any parts of this template not applicable to your Issue.

Bug reports:

Please replace this line with a brief summary of your issue AND if reporting a build issue include the link from:

Katoo$ ruby -e «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)»
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/.
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew.

You must: brew install git
You must: brew install git
Error: Git is unavailable
Failed during: /usr/local/bin/brew tap homebrew/core
macbookato:

Katoo$ brew install wget
You must: brew install git
You must: brew install git
You must: brew install git
You must: brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
macbookato:

Katoo$ brew update
You must: brew install git
You must: brew install git
Error: Git must be installed and in your PATH!
macbookato:

Katoo$ brew update
You must: brew install git
You must: brew install git
Error: Git must be installed and in your PATH!
macbookato:

Katoo$ brew doctor
You must: brew install git
You must: brew install git
You must: brew install git
You must: brew install git
Error: Git is unavailable
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core -q
macbookato:

Katoo$ brew edit $FORMULA
You must: brew install git
You must: brew install git
Error: Changes will be lost!
The first time you brew update’, all local changes will be lost, you should thus brew update’ before you brew edit’! macbookato:

Источник

brew update fails with «Git must be installed and in your PATH!» #3029

brew update fails with this error:

Detailed infos follows. Thanks for any help!

$ brew update Warning: git-2.9.0 already installed Error: Git must be installed and in your PATH! $ which -a git /usr/local/bin/git /usr/local/bin/git /usr/bin/git $ echo $PATH /Users/stefanscheidt/.sdkman/candidates/maven/current/bin:/Users/stefanscheidt/.sdkman/candidates/ant/current/bin:/Users/stefanscheidt/.rbenv/shims:/Users/stefanscheidt/.nvm/versions/node/v4.3.2/bin. /Users/stefanscheidt/.local/bin:/Users/stefanscheidt/local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin»>

The text was updated successfully, but these errors were encountered:

As of about 30 minutes ago I’m having the exact same problem.

You may need to:

To escape the error. Should only need doing once if brew update remains stuck.

@DomT4 Don’t think that’s necessary any more but folks: if it is, please let me know.

It seems to be, based on checking locally & our CI output. If you ended up there, can’t seem to brew update successfully.

For me, brew update seems to work fine again!

Thanks for the super fast fix!

I had to switch to master to get it work again, and still getting the weird message:

@hannesN What’s your brew doctor and brew config output?

I had the same issues as above, my brew doctor output looked like

I ran xcode-select —install and made sure i had /usr/local/sbin in my path and now brew’s working great again.

Btw, it was working fine yesterday, I think installing macOS High Sierra last night is what tripped it up.

What happens if you manually run git after the update to High Sierra? Does it throw out anything interesting?

The above solution ( xcode-select —install ) fixed my issue, so I deleted my previous comment.
I do remember that running git would print an error message right after the upgrade to High Sierra, but unfortunately I cannot remember the exact error. But I managed to fix it then (again I can’t remember how exactly 🙁

I had this problem this morning, and after reading the comments here I figured it could be related to me having moved Xcode.app to the trash a few days ago. I tried some of the commands suggested here, namely xcode-select —install but nothing worked. Here’s a detailed walkthrough of what I did, although I think the last step alone might fix this issue for you.

Removed all Xcode.app-related leftovers, according to the commands listed in the top answer to this question (and the top comment to that answer, as well).

I ran sudo rm -rf /Library/Developer/CommandLineTools which deleted my standalone version of the command line tools. You might not have this, so this command might return «No such file or directory». This is fine.

I (re)installed the standalone command line tools with xcode-select —install . This still didn’t fix Homebrew finding git for me, so I then read the man page for xcode-select and I did.

sudo xcode-select -r . This should make your brew doctor output «ready to brew».

You might also need to update the newly installed command line tools with the App Store; a new update should show up in the «Updates» section.

Источник

brandonsimpson / reinstall_git_brew.md

Re-installing Git on Mac OSX with Brew

This is helpful if you’ve previously installed git from source on OSX, and other compilers can’t find the correct path. You need to remove the current version of git, then re-install with brew.

Uninstall git if installed manually

Check which git you’re running:

output should be similar to this: /usr/bin/git

Remove that git install

Re-install git with brew

Check which git you’re now running:

Should now say: /usr/local/bin/git

I follow the instructions and then I am being requested to enter a password.

I do enter the password, but I get an error message:

Thanks for your help.

I have gone through the steps you listed in this instruction set, however once I run the «sudo rm -rf /usr/bin/git/» I get the error

rm: /usr/bin/git: Operation not permitted

I am currently running MacOS Mojave v.10.14.6.

and I have Xcode installed (if that means anything).

Please advise.
-Pete8451

I have gone through the steps you listed in this instruction set, however once I run the «sudo rm -rf /usr/bin/git/» I get the error

rm: /usr/bin/git: Operation not permitted

I am currently running MacOS Mojave v.10.14.6.

and I have Xcode installed (if that means anything).

Did you found out a solution for your problem?? I got the same error «Operation not permitted» and I’ve been struggling for days with this problem

I have gone through the steps you listed in this instruction set, however once I run the «sudo rm -rf /usr/bin/git/» I get the error
rm: /usr/bin/git: Operation not permitted
I am currently running MacOS Mojave v.10.14.6.
and I have Xcode installed (if that means anything).
Please advise.
-Pete8451

Did you found out a solution for your problem?? I got the same error «Operation not permitted» and I’ve been struggling for days with this problem

Hey people! I was able to get this issue resolved. However i had to install manually (not using brew initially).

I followed the steps from the Git website to reinstall Git.
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
It automatically updated the git version i had on my Mac. Having XCode on my device did not effect the install. I know this may seem broad, but it worked for me!! hope this helps!

Hi guys, I am having a similar issue. I checked my git version and it was 2.23.0, I did brew install git which should have updated to 2.28.0 I believe however when I restarted my mac and checked git version I still see 2.23.0. I checked which git and it shows «/usr/local/bin/git». How do I know if I am using the right git on my system?

rm: /usr/bin/git: Operation not permitted is because Mac’s «System Integrity Protection».

Hey people! I was able to get this issue resolved. However i had to install manually (not using brew initially).

I followed the steps from the Git website to reinstall Git.
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
It automatically updated the git version i had on my Mac. Having XCode on my device did not effect the install. I know this may seem broad, but it worked for me!! hope this helps!

this worked for me — now running: git version 2.27.0 Catalina 10.15.7

Hi guys, I am having a similar issue. I checked my git version and it was 2.23.0, I did brew install git which should have updated to 2.28.0 I believe however when I restarted my mac and checked git version I still see 2.23.0. I checked which git and it shows «/usr/local/bin/git». How do I know if I am using the right git on my system?

IMPORTANT EDIT — Any solution I wrote in this comment should be ignored unless you’ve already done the following: restarted your terminal after running brew install git (important!), ensured which git is returning /usr/local/bin/git and that this is what brew installed, confirmed /usr/local/bin/git —version is displaying the new version installed via brew, and if git —version is still returning the old Xcode version even after restarting your terminal then you can either use simple workarounds to add the path to the proper git install as others and myself mentioned (shown below this edit) or you can use people’s solutions above to remove Xcode’ git . However it’s unlikely any of this is necessary with newer versions of macOS if you’ve restarted the terminal after installing git with homebrew. For details see @martbe’s comment and my comment below it that explains where confusion can happen after installing git with homebrew alongside Xcode’s git. For newer versions of macOS, the problem that myself and possibly others experienced is due to simply not restarting the terminal after running brew install git .

See above edit before reading further.

If you do which -a git you’ll notice there are multiple versions of git installed assuming you have one installed from XCode (or straight from git) and another that you’ve just installed from homebrew.

The one in /usr/local/bin/git is the one from homebrew which you can confirm with ls -al /usr/local/bin/git and you’ll see it’s symlinked to the git binary installed in homebrew’s Cellar directory. You can alternatively confirm by passing —version to each absolute command path to see which is which.

When you run a non-absolute command like git it will search directories in the $PATH environment variable and use the first command it finds so you should run echo $PATH and ensure that /usr/local/bin comes before /usr/bin , and if it does then running git should run the correct command for you. Btw, macOS sets up the $PATH variable this way by default but if you’ve changed your $PATH just ensure that /usr/local/bin comes first.

If the above is true and $PATH is correct but git —version is still running the /usr/bin/git command then the quickest and simplest fixes are to either:

    Set an alias like somebody else said by adding alias git=»/usr/local/bin/git» to

/.bash_aliases .

  • Add the correct git command to $PATH by adding export PATH=$PATH:/usr/local/bin/git
  • If that case is happening where $PATH is correctly loading from /usr/local/bin first but git is still running the /usr/bin/git command, I think this may have to do with Xcode overriding things but somebody else who’s more knowledgeable of Xcode can confirm this since I’m not sure. I’ve just seen odd things like this before, and it would explain some of these weird cases (and I know Xcode has things like xcrun to find tools). I’m just not sure. EditThis could also be related to @martbe’s point about reloading terminal, even for older versions, not sure. I’m leaving this be now lol. I’ve done enough damage!

    Источник

    Homebrew not finding newer git from $PATH #6274

    • are reporting a bug others will be able to reproduce and not asking a question. If you’re not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
    • ran a brew command and reproduced the problem with multiple formulae? If it’s a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it’s a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it’s a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
    • ran brew update and can still reproduce the problem?
    • ran brew doctor , fixed all issues and can still reproduce the problem?
    • ran brew config and brew doctor and included their output with your issue?

    What you were trying to do (and why)

    brew update a new install of LinuxBrew to /extra/josephlong/.linuxbrew .

    What happened (include command output)

    Despite the existence of a newer git on $PATH :

    Homebrew appears to use system git , which is much older:

    which results in the following errors:

    Tag creation options
    -a annotated tag, needs a message
    -m message for the tag
    -F message in a file
    -s annotated and GPG-signed tag
    -u use another key to sign the tag
    -f, —force replace the tag if exists

    Tag listing options
    —contains print only tags that contain the commit

    error: unknown option `list’
    usage: git tag [-a|-s|-u ] [-f] [-m |-F ] []
    or: git tag -d .
    or: git tag -l [-n[]] []
    or: git tag -v .

    Tag creation options
    -a annotated tag, needs a message
    -m message for the tag
    -F message in a file
    -s annotated and GPG-signed tag
    -u use another key to sign the tag
    -f, —force replace the tag if exists

    Tag listing options
    —contains print only tags that contain the commit

    Read the analytics documentation (and how to opt-out) here:
    https://docs.brew.sh/Analytics

    error: unknown option `local’
    usage: git config [options]

    Config file location
    —global use global config file
    —system use system config file
    -f, —file use given config file

    Action
    —get get value: name [value-regex]
    —get-all get all values: key [value-regex]
    —get-regexp get values for regexp: name-regex [value-regex]
    —replace-all replace all matching variables: name value [value_regex]
    —add adds a new variable: name value
    —unset removes a variable: name [value-regex]
    —unset-all removes all matches: name [value-regex]
    —rename-section rename section: old-name new-name
    —remove-section remove a section: name
    -l, —list list all
    -e, —edit opens an editor
    —get-color find the color configured: [default]
    —get-colorbool
    find the color setting: [stdout-is-tty]

    Type
    —bool value is «true» or «false»
    —int value is decimal number
    —bool-or-int value is —bool or —int
    —path value is a path (file or directory name)

    Other
    -z, —null terminate values with NUL byte

    Error: Failure while executing; git config —local —replace-all homebrew.analyticsmessage true exited with 129.

    What you expected to happen

    I expected brew update to complete without errors.

    Step-by-step reproduction instructions (by running brew commands)

    brew doctor

    brew config

    The text was updated successfully, but these errors were encountered:

    Источник

    I am trying to install git using homebrew:

    brew install git

    Terminal reads:

    ==> Searching for similarly named formulae… Error: No similarly named formulae found. Error: No available formula or cask with the
    name «git».
    ==> Searching for a previously deleted formula (in the last month)… Error: No previously deleted formula found.
    ==> Searching taps on GitHub… Error: No formulae found in taps.

    If I input brew doctor, I get the following:

    Warning: Suspicious https://github.com/Homebrew/homebrew-core git
    origin remote found. The current git origin is:
    https://github.com/Homebrew/brew With a non-standard origin, Homebrew
    won’t update properly. You can solve this by setting the origin
    remote: git -C
    «/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core» remote
    set-url origin https://github.com/Homebrew/homebrew-core

    However, if i do git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/Homebrew/homebrew-core, nothing changes and I get the same output with brew doctor

    command line tools is installed:

    xcode-select --install

    xcode-select: error: command line tools are already installed, use
    «Software Update» to install updates

    I have tried reinstalling brew, brew update and brew cleanup

    Any help would be greatly appreciated.

    I’m encountering a really weird issue when I try to use the latest version of git I just installed via homebrew. which git is pointing me to the homebrew install, but calling git returns the original version installed with OS X.

    I checked first to see the original version I was on.

    [user@home ~]$ git --version
    git version 1.8.5.2 (Apple Git-48)
    

    Then I went to homebrew to install the latest version.

    [user@home ~]$ brew install git
    ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.0.0.mavericks.bottle.2.tar.gz
    ######################################################################## 100.0%
    ==> Pouring git-2.0.0.mavericks.bottle.2.tar.gz
    ==> Caveats
    The OS X keychain credential helper has been installed to:
      /usr/local/bin/git-credential-osxkeychain
    
    The 'contrib' directory has been installed to:
      /usr/local/share/git-core/contrib
    
    Bash completion has been installed to:
      /usr/local/etc/bash_completion.d
    
    zsh completion has been installed to:
      /usr/local/share/zsh/site-functions
    ==> Summary
    🍺  /usr/local/Cellar/git/2.0.0: 1324 files, 31M
    

    Looks like it worked! Check that it’s pointing to the correct git

    [user@home ~]$ which git
    /usr/local/bin/git
    

    Should be good, right? Not so fast

    [user@home ~]$ git --version
    git version 1.8.5.2 (Apple Git-48)
    

    That’s weird. Am I really pointing to the right git?

    [user@home ~]$ ls -l /usr/local/bin/git
    lrwxr-xr-x  1 user  group  27 Jul  3 15:54 /usr/local/bin/git -> ../Cellar/git/2.0.0/bin/git
    

    Sure looks like it. Works when I call it manually

    [user@home ~]$ /usr/local/Cellar/git/2.0.0/bin/git --version
    git version 2.0.0
    

    But not as git

    [user@home ~]$ which git
    /usr/local/bin/git
    [user@home ~]$ git --version
    git version 1.8.5.2 (Apple Git-48)
    

    Any ideas as to what could be causing this?

    EDIT: Solved it. source .bashrc fixed it. Still curious as to why which would return me the correct executable but it wouldn’t be called though, if anyone can explain that.

    wheredyoufindthis opened this issue 7 years ago · comments

    I have git 1.7.1
    I try to

    $ brew install python3
    ==> Tapping homebrew/dupes
    error: unknown option `config

    or

    $ brew update
    error: unknown option `no-edit'

    That mistakes about the age of my git’s version, but I can’t find out what version is better to use
    Under some circumstances I can’t use cutting-edge 2.* versions :(

    I don’t know which minimum version is required either. =p
    Try brew install git

    I thought git config went back to day one of git? Strange. Please report

    which -a git
    git --version
    git config user.name

    Never mind my previous message. The command that’s causing the error is: git clone --config.
    We need to add a brew doctor check to check the version of git.
    brew install git should fix your trouble.

    Thank you for the answer!
    I suppose that the only way to install git is installing it from sources

    Cause brew uses git to fetch git

    I thought such a doctor check already existed. I remember seeing it just yesterday. Might just have to change the minimum required version.

    @tulindanil Please report brew doctor

    An outdated version of Git was detected in your PATH.
    Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
    Please upgrade: brew #{git_upgrade_cmd} git
    

    I have git 1.7.1

    Your version of git is too old (but we already knew that).

    Cause brew uses git to fetch git

    Are you sure? It shouldn’t. It’s a bug if it does.

    $ brew install git -v
    ==> Installing dependencies for git: patchelf, zlib, binutils, linux-headers, glibc, xz, gmp, gpatch, mpfr, libmpc, isl, gcc, makedepend, openssl, pkg-config, curl, expat
    

    It would be helpful I think to run Diagnostic::check_for_git before brew tap or brew update. In fact, I though it did do this, but I guess not.

    It is my fault that I did not launch that command
    But nevertheless it will be great if this information will be on your website!

    $ brew doctor
    
    ...
    
    Warning: An outdated version of Git was detected in your PATH.
    Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
    Please upgrade: brew install git
    
    ...
    

    And my git is really dummy

    $ brew install git -v
    ==> Tapping homebrew/dupes
    git clone https://github.com/Homebrew/homebrew-dupes /home-local/gratom/satom12/.linuxbrew/Library/Taps/homebrew/homebrew-dupes --config core.autocrlf=false --depth=1
    error: unknown option `config'
    ...
    Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-dupes /home-local/gratom/satom12/.linuxbrew/Library/Taps/homebrew/homebrew-dupes --config core.autocrlf=false --depth=1

    Thank you very much, you are awesome!

    I want to figure out why your git depends on homebrew/dupes, but my git does not.
    Please report brew deps git and brew deps --tree git

    $ brew deps --tree git
    git (required dependencies)
    ├── xz
    ├── xz
    ├── xz
    ├── openssl
    │   ├── makedepend
    │   │   └── pkg-config
    │   ├── gpatch
    │   │   └── xz
    │   ├── gpatch
    │   │   └── xz
    │   └── zlib
    ├── curl
    │   ├── pkg-config
    │   ├── gpatch
    │   │   └── xz
    │   └── openssl
    │       ├── makedepend
    │       │   └── pkg-config
    │       ├── gpatch
    │       │   └── xz
    │       ├── gpatch
    │       │   └── xz
    │       └── zlib
    └── expat
    

    You can also try brew install -s git

    $ brew deps git
    Error: No available formula with the name "homebrew/dupes/m4" 
    Please tap it and then try again: brew tap homebrew/dupes
    
    $ brew deps --tree git
    git (required dependencies)
    ├── xz
    ├── xz
    ├── xz
    ├── openssl
    │   ├── make depend
    │   │   └── pig-config
    │   ├── patch
    │   │   └── xz
    │   ├── patch
    │   │   └── xz
    │   └── lib
    ├── curl
    │   ├── pig-config
    │   ├── patch
    │   │   └── xz
    │   └── openssl
    │       ├── make depend
    │       │   └── pig-config
    │       ├── patch
    │       │   └── xz
    │       ├── patch
    │       │   └── xz
    │       └── lib
    └── expat
    
    $ brew install -s git
    ==> Tapping homebrew/dupes
    error: unknown option `config'
    ...
    

    I can reproduce this bug on CentOS 6 with git 1.7.1.

    $ brew tap homebrew/dupes
    ==> Tapping homebrew/dupes
    error: unknown option `config'
    usage: git clone [options] [--] <repo> [<dir>]
    …
    Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-dupes /home/sjackman/.linuxbrew/Library/Taps/homebrew/homebrew-dupes --config core.autocrlf=false --depth=1
    

    But nevertheless it will be great if this information will be on your website!

    There isn’t a git dependency listed, because brew install git is supposed to work. It’s a bug that it doesn’t.

    Now that I can reproduce this bug, I’ll work on figuring it out.

    $ brew deps git --skip-optional
    curl
    expat
    gpatch
    makedepend
    openssl
    pkg-config
    xz
    zlib
    
    $ brew deps git
    Error: No available formula with the name "homebrew/dupes/m4" 
    Please tap it and then try again: brew tap homebrew/dupes
    

    The tapping logic is trying to tap due to an optional dependency, even though it won’t be installed.

    Try

    brew install patchelf
    brew install zlib
    brew install binutils
    brew install linux-headers
    brew install glibc
    brew install xz
    brew install gmp
    brew install gpatch
    brew install mpfr
    brew install libmpc
    brew install isl
    brew install gcc
    brew install makedepend
    brew install openssl
    brew install pkg-config
    brew install curl
    brew install expat
    brew install git

    @ilovezfs Hi, Joe. When installing git, the tapping logic is trying to tap Homebrew/dupes due to an optional dependency of git (somewhere down the dependency chain), which isn’t actually going to be installed. The problem is that git isn’t yet installed, so the tapping fails.

    Related:

    $ brew deps git
    Error: No available formula with the name "homebrew/dupes/m4" 
    Please tap it and then try again: brew tap homebrew/dupes
    

    I’m less worried about this error. In fact, I’m just fine with the current behaviour.

    I think this issue will be resolved one day by creating a statically-linked-git formula following the guides from here.

    Does anyone know whether the git bottle is relocatable in practice? It’s not currently marked as being cellar :any.

    In fact, I’m just fine with the current behaviour.

    Except that I never understood why --skip-optional isn’t the default behaviour. I think that --with-all-options should be the opt-in behaviour. brew deps foo should show the packages that would be installed by brew install foo, and have options to give other behaviour, with respect to bottles and options.

    As for git versions and brew doctor complaining: ipython/ipython#2195 . It seems releases after 1.7.9.5 should suffice.

    Can we close this issue since we have the brew doctor check?

    I had similar problem, when I tried to upgrade from linuxbrew git 2.8 to 2.8.2 I got following error

    Error: Failure while executing: git config --local --replace-all homebrew.private false

    The solution for me is to remove git 1.7.1 from CenOS but I am surprised to see this problem as I have linuxbrew git comes first in my $PATH.

    [njia@centos6 Desktop]$ brew outdated
    readline (6.3.8 < 6.3.8_1)
    vim (7.4.1655 < 7.4.1795)
    git (2.8.0 < 2.8.2)
    sqlite (3.11.0_1 < 3.12.2)
    ansible (2.0.1.0 < 2.0.2.0)
    openssl (1.0.2g < 1.0.2h)
    [njia@centos6 Desktop]$ brew upgrade git
    ==> Upgrading 1 outdated package, with result:
    git 2.8.2
    ==> Upgrading git
    ==> Installing dependencies for git: openssl
    ==> Installing git dependency: openssl
    error: unknown option `local'
    usage: git config [options]
    
    Config file location
        --global              use global config file
        --system              use system config file
        -f, --file <FILE>     use given config file
    
    Action
        --get                 get value: name [value-regex]
        --get-all             get all values: key [value-regex]
        --get-regexp          get values for regexp: name-regex [value-regex]
        --replace-all         replace all matching variables: name value [value_regex]
        --add                 adds a new variable: name value
        --unset               removes a variable: name [value-regex]
        --unset-all           removes all matches: name [value-regex]
        --rename-section      rename section: old-name new-name
        --remove-section      remove a section: name
        -l, --list            list all
        -e, --edit            opens an editor
        --get-color <slot>    find the color configured: [default]
        --get-colorbool <slot>
                              find the color setting: [stdout-is-tty]
    
    Type
        --bool                value is "true" or "false"
        --int                 value is decimal number
        --bool-or-int         value is --bool or --int
        --path                value is a path (file or directory name)
    
    Other
        -z, --null            terminate values with NUL byte
    
    Error: Failure while executing: git config --local --replace-all homebrew.private false
    
    [njia@centos6 Desktop]$ su -
    Password: 
    [root@centos6 ~]# yum erase git
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Setting up Remove Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package git.x86_64 0:1.7.1-4.el6_7.1 will be erased
    --> Processing Dependency: git = 1.7.1-4.el6_7.1 for package: perl-Git-1.7.1-4.el6_7.1.noarch
    --> Running transaction check
    ---> Package perl-Git.noarch 0:1.7.1-4.el6_7.1 will be erased
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ======================================================================================================================================
     Package                       Arch                        Version                                Repository                     Size
    ======================================================================================================================================
    Removing:
     git                           x86_64                      1.7.1-4.el6_7.1                        @updates                       15 M
    Removing for dependencies:
     perl-Git                      noarch                      1.7.1-4.el6_7.1                        @updates                       35 k
    
    Transaction Summary
    ======================================================================================================================================
    Remove        2 Package(s)
    
    Installed size: 15 M
    Is this ok [y/N]: y
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Erasing    : git-1.7.1-4.el6_7.1.x86_64                                                                                         1/2 
      Erasing    : perl-Git-1.7.1-4.el6_7.1.noarch                                                                                    2/2 
      Verifying  : perl-Git-1.7.1-4.el6_7.1.noarch                                                                                    1/2 
      Verifying  : git-1.7.1-4.el6_7.1.x86_64                                                                                         2/2 
    
    Removed:
      git.x86_64 0:1.7.1-4.el6_7.1                                                                                                        
    
    Dependency Removed:
      perl-Git.noarch 0:1.7.1-4.el6_7.1                                                                                                   
    
    Complete!
    [root@centos6 ~]# exit
    logout
    [njia@centos6 Desktop]$ brew upgrade git
    ==> Upgrading 1 outdated package, with result:
    git 2.8.2
    ==> Upgrading git
    ==> Installing dependencies for git: openssl
    ==> Installing git dependency: openssl
    ==> Downloading https://www.openssl.org/source/openssl-1.0.2h.tar.gz
    curl: (35) SSL connect error
    Trying a mirror...
    ==> Downloading https://dl.bintray.com/homebrew/mirror/openssl-1.0.2h.tar.gz
    ######################################################################## 100.0%
    ==> perl ./Configure --prefix=/home/njia/.linuxbrew/Cellar/openssl/1.0.2h --openssldir=/home/njia/.linuxbrew/etc/openssl no-ssl2 zlib-
    ==> make depend
    ==> make
    ==> make test
    ==> make install MANDIR=/home/njia/.linuxbrew/Cellar/openssl/1.0.2h/share/man MANSUFFIX=ssl
    ==> Downloading https://curl.haxx.se/ca/cacert-2016-04-20.pem
    ######################################################################## 100.0%
    ==> Caveats
    A CA file has been bootstrapped using certificates from the system
    keychain. To add additional certificates, place .pem files in
      /home/njia/.linuxbrew/etc/openssl/certs
    
    and run
      /home/njia/.linuxbrew/opt/openssl/bin/c_rehash
    
    ==> Summary
    /home/njia/.linuxbrew/Cellar/openssl/1.0.2h: 1,698 files, 14M, built in 4 minutes
    ==> Installing git
    ==> Downloading https://www.kernel.org/pub/software/scm/git/git-2.8.2.tar.xz
    ######################################################################## 100.0%
    ==> make install prefix=/home/njia/.linuxbrew/Cellar/git/2.8.2 sysconfdir=/home/njia/.linuxbrew/etc CC=/usr/bin/gcc CFLAGS=-Os -w -pip
    ==> make CC=/usr/bin/gcc CFLAGS=-Os -w -pipe -march=core2 LDFLAGS=-L/home/njia/.linuxbrew/lib -Wl,--dynamic-linker=/home/njia/.linuxbr
    ==> Downloading https://www.kernel.org/pub/software/scm/git/git-manpages-2.8.2.tar.xz
    ######################################################################## 100.0%
    ==> Downloading https://www.kernel.org/pub/software/scm/git/git-htmldocs-2.8.2.tar.xz
    ######################################################################## 100.0%
    ==> Caveats
    The OS X keychain credential helper has been installed to:
      /home/njia/.linuxbrew/bin/git-credential-osxkeychain
    
    The "contrib" directory has been installed to:
      /home/njia/.linuxbrew/share/git-core/contrib
    
    Bash completion has been installed to:
      /home/njia/.linuxbrew/etc/bash_completion.d
    
    zsh completion has been installed to:
      /home/njia/.linuxbrew/share/zsh/site-functions
    
    
    Emacs Lisp files have been installed to:
      /home/njia/.linuxbrew/share/emacs/site-lisp/git
    ==> Summary
    /home/njia/.linuxbrew/Cellar/git/2.8.2: 1,342 files, 29.1M, built in 1 minute 3 seconds
    

    Hi, Nija. The workaround for your issue is

    PATH=`brew --prefix git`/bin:$PATH brew upgrade git

    It needs a proper fix.

    Home
    > 10.7.3, homebrew, xcode > Installing git on Mac OS X Lion through Homebrew error fix

    I recently did a fresh 10.7.3 installation onto an i5 hackintosh and installed Xcode on it through the app store. Then I installed my favorite tool homebrew through this one-line command. Everything went well except when I tried to install git (actually any brew install command would fail regardless the package) through homebrew I got the following error:


    Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.9.1 CC=/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc CFLAGS=-Os

    A little digging shows that file /usr/bin/make is missing, further digging reveals that the new Xcode makes the command line tools one of the optional components so in order to use homebrew, the command line tools must be installed via Xcodes -> Preferences -> Downloads -> Command Line Tools -> Install. brew install package_name works like a charm again like it used to on 10.7.2 once command line tools is installed.

    Screenshot (after Xcode Command Line Tools is installed):

    [UPDATE 2/19/2012] Additional note on installing redis with homebrew:
    brew install redis would fail, even with Command Line Tools component installed, for now you need to use option --llvm to install redis:
    brew install redis --use-llvm
    Solution is found through https://github.com/mxcl/homebrew/issues/10305.

    TL; DR: Если вам просто нужно решение / обходной путь, игнорируйте раздел «Как я нашел проблему» и приложение в конце.

    Как я нашел проблему

    После выполнения команды brew ниже

    brew update -vd --preinstall >brewlog.txt 2>&1
    

    И проверив файл brewlog.txt, я понял, что две ошибки появляются, когда Homebrew пытается получить доступ к двум кранам, которые я создал в своей учетной записи Github.com, чтобы «извлечь» более старые версии некоторых пакетов, чтобы установить эти старые версии, так как это процедура специально предложена Homebrew (см. приложенные примечания в конце).

    В частности, во время автоматического обновления Homebrew пытается получить доступ к этим двум касаниям, то есть к соответствующим двум репозиториям, и пытается выполнить следующие две команды.

    git remote set-head origin --auto
    git symbolic-ref refs/remotes/origin/HEAD
    

    Но поскольку те нажатия, которые я создал в своей учетной записи Github, хранились как пустые репозитории, поэтому не было никаких коммитов и не было HEAD, и поэтому git отвечает Cannot determine remote HEAD и остальными сообщениями об ошибках.

    Как я понял что делать

    Чтобы решить эту проблему или, по крайней мере, найти обходной путь, я просто добавил некоторое содержимое в репозитории. В частности, файл brewlog.txt показал, что приведенные выше команды git выполняются изнутри следующего вида пути.

    /usr/local/Homebrew/Library/Taps/GITHUBACCOUNTNAME/PACKAGENAME
    

    Итак, я перешел к этим двум папкам и заметил, что на самом деле локально существует папка с именем Formula, содержащая файл с именем PACKAGENAME.rb. Полагаю, это содержимое было сохранено Homebrew при установке старых версий.

    Как я это решил

    Итак, что я сделал для того, чтобы « заполнить » мои два касания Github, было просто добавить это содержимое к удаленным ответвлениям, выполнив следующие команды из каждой из двух папок.

    git add Formula
    git commit -m "First commit"
    git push
    

    Теперь у этих двух кранов есть ГОЛОВА, и Homebrew больше не жалуется.

    Дополнительные примечания по установке более старых версий

    Раньше можно было установить более старую версию пакета Homebrew, просто найдя « правильную фиксацию » на Github (подробности см. В здесь) и написав что-то вроде этого.

    brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8cf29889111b44fd797c01db3cf406b0b14e858c/Formula/PACKAGENAME.rb
    

    Теперь это больше не работает, поскольку Homebrew отвечает примерно так:

    Invalid usage: Installation of PACKAGENAME from a GitHub commit URL is unsupported! `brew extract PACKAGENAME` to a stable tap on GitHub instead. (UsageError)
    

    Вот что я сделал: я создал два (частных) пустых крана в моей учетной записи Github и использовал brew extract для «извлечения» старых версий в эти ответвления, поэтому использовал эти два касания как «указатели» на старые версии.

    Но это извлечение выполняется просто локально с помощью Homebrew, поэтому репозитории в моей учетной записи Github все еще пусты, и при автоматическом обновлении и проверке этих двух репозиториев Github не удавалось определить удаленный HEAD. Поэтому я решил это, как описано выше.

    Понравилась статья? Поделить с друзьями:
  • Brew error unknown command switch
  • Bremsen fehler ошибка на фольксваген пассат б5
  • Bremse ошибка на ауди что значит
  • Bremsbelag prufen ошибка на фольксваген б5
  • Breeders of the nephilim как изменить персонажа