The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

2202

Open Terminal, and run the following: xcode-select --install This will download and install xcode developer tools and fix the problem. You do not need Xcode, you can install only the Command Line Tools here, it is about 130Mb. The problem is that one needs to explicitly agree to the license agreement. As a follow on step, you may need to reset the path ...


484

ok, so I needed the git autocompletion script. I got that from this url: curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash No need to worry about what directory you're in when you run this as your home directory(~) is used with the target. Then I added to my ~/.bash_profile file the ...


106

Thanks everyone for helpful answers. In my case adding export PATH="/usr/local/bin:${PATH}" in ~/.bash_profile followed by source ~/.bash_profile solved the problem for my user.


91

Some people prefer to use a package manager to automate the installing, updating, and configuring of Mac OS packages. I am a fan of package managers, and I think Homebrew is the best package manager for Mac OS (some would say it's the de-facto Mac OS package manager). Once you have installed Homebrew, you can simply install git along with bash-completion ...


73

If you don't want to install nor use Xcode (I don't) you can install only command tools for Xcode (please see Edit) Preconditions: you have AppleID Solution Go to https://developer.apple.com/download/more/ and find Command line tools OS X 10.11) for Xcode 7.1. Then install downloaded .dmg package. Newer versions It should work with newer versions of ...


55

I ran into the exact same problem. After some digging, I finally figured out what the root problem is. They made some major changes to the git-completion.bash script which requires a new feature in git v2.18, --list-cmds. The problem is that none of the package managers have updated to git v2.18 yet. Most of the instructions out there say to download raw....


44

Ok, I'm ready to get serious about scm. $ git --version git version 1.9.5 (Apple Git-50.3) Nope, that's not what I wanted. I <3 homebrew, so: $ brew install git All set? $ git --version git version 1.9.5 (Apple Git-50.3) Doh! (scratches head) $ which git /usr/bin/git Ah, Apple's git is in /usr/bin, so it trumps the homebrew one. What to do? (A) ...


43

For macOS High Sierra, just run the same command: xcode-select --install and everything will get back to work. 2019 UPDATE: This is needed for every new macOS version, so it'll work for Catalina as well.


38

No, this isn't a virus1. It seems that your name and email address are not set up properly in Git. Go to Xcode Preferences and then Accounts, select the repository, and check the username. You can also do this via the command line: git config --global user.email "you@example.com" git config --global user.name "Your Name" 1: The message content can be ...


35

Scripts run via Automator use the default search path which usually does not include /usr/local/bin. In your case an easy fix would be to put export PATH=/usr/local/bin:$PATH somewhere at the beginning of the script.


32

Run this on terminal: curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash Then, do this: vi ~/.bash_profile Add this lines: if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash fi That's all. This worked for me.


32

Status 2019 All the tricks mentioned here in several answers are not necessary anymore on macOS Sierra & Mojave with latest Homebrew. Forget export PATH="..."and modifications to ~/.bash_profile. You simply do brew install git and your done. To confirm, open a new (!) terminal window and type git --version


28

Here are the steps I needed to go through for Mojave: First xcode-select --reset. Next I needed to upgrade xcode tools to the latest version: sudo softwareupdate -ia --verbose (NB: this runs all available updates from the app store, there is a way to specify that you only want to update one app/program, but I don't know it off the top of my head). You can ...


26

git is installed by Xcode. I doubt you'll have any problems if you replace it, but I can't give you a definitive answer to that… What I'd do is rename the old /usr/bin/git to git_old, then rely on your path to select the new one. If that doesn't work, move the new one to /usr/bin. I doubt Xcode is picky about which version of git it's using. If that still ...


26

It looks like you're inside the vi editor. Typing :wq and pressing enter should do it, i.e. save the commit message and exit. : enters the command mode, w is for "write" (save) and q is for "quit". You may need to hit escape before :wq to exit the insert mode (vi is a mode based editor). If you want to exit without saving hit escape, :q! and enter. ...


24

OK, I found the problem: the message was coming from the remote git server, not the client side. I ran sudo xcodebuild -license on the server side (where the repo is located and the git server is running) and the problem went away. Sigh.


22

You are confusing the basic bash completion with the add on required for completing git commands. The git that is installed by Apple lacks the required git-completion.bash file so you need to install the full git. You can do this easily with homebrew -brew install git will do the job. Once you've done that then uncomment your top three lines :- if [ -f $(...


21

As asked and answered on stackoverflow, there's an easier way to do this that doesn't involve making a new file system in a disk image file: Move your existing file aside, commit that move, then move it back using the case you'd like it to maintain and commit. Done. Example: mv foo foo2 git add -A git commit -m "renaming" mv foo2 FOO git add -A git commit ...


19

I tried the xcode-select --install but I was forced to install it from the App Store. Then all git stuff ran smoothly.


15

Do not uninstall Apple-distributed Git. You can leave it as it is and run another version by having it in a directory earlier in PATH environment variable. The easiest way to install another version on OS X would be to use Homebrew packet manager. After installing it, you can run: brew install git Homebrew (brew) will take care of all dependencies and ...


14

As answered here: https://stackoverflow.com/questions/22699614/git-commit-messages-lost-by-vi The real solution is to git config --global core.editor vim -f According to vim documentation - -f option should be used when Vim is executed by a program that will wait for the edit session to finish


14

vi is existing with a non-zero status, although without additional details about your setup, it's difficult to tell why. If you're using a lot of plugins to vim, you might try moving your .vimrc file to .vimrc.back and seeing if you can replicate. There are a few sources that discuss this problem, including at least one with a potential solution: git config ...


13

A solution when switching from ubuntu is to use homebrew, a package manager for Mac OSX. In particular, for git, you will have included a number of additions including bash completion. This will be true for other programs which are faliliar for developpers, like make. In 2 steps: install with ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/...


13

The accepted answer is correct, but also note that git does not make it obvious if the error is coming from remote or from local. If you are running OS X on your remote, your install problem may be on the remote side and you'll see the same error on git clone and git pull but NOT on git status.


12

git and git-completion.bash already come with macOS command line tools (xcode-select --install). To enable bash autocomplete, add this to your ~/.bash_profile. [ -f /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash ] && . /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash This will also enable ...


11

The easiest way to get autocompletion on OS X is to switch your shell to zsh. Change default shell from bash to zsh You can test things by running zsh in iTerm and terminal before making the switch above. If you really want to stick with bash you can start with these two questions: Is there a way to auto-complete the open command in Terminal? How can I ...


11

xcode-select --install and xcode-select --reset didn't work for me. I had to download it manually from Apple Developers website: https://developer.apple.com/download/ Choose the Command line of your current OS.


10

For a more general solution to the bash environment in automator differing from your own you could simply load your personal bash profile at the first line of the automator bash script: source ~/.bash_profile This will make the path and any other environment variables you're used to using available from your automator script.


10

There are two steps to stopping GitHub Conduit: telling GitHub.app to not re-install the job with launchd and telling launchd to not run it anymore. Disable Conduit installation: defaults write com.github.GitHub GHShouldDisableConduit -bool yes Remove launchd job: launchctl remove com.github.GitHub.Conduit


9

You don't need to go hacking the other version out unless you are really tight for space. Edit your .bash_profile and make sure that /usr/local/bin occurs in front of /usr/bin in your PATH variable Personally I prefer to adopt a scheme with tool paths defined and the path built from these e.g. GIT_HOME=/usr/local PATH=${GIT_HOME}/bin:${PATH};export PATH ...


Only top voted, non community-wiki answers of a minimum length are eligible