21

My install of git seems to be broken, and it looks like somehow my Developer Tools are broken.

When I try to run git, I get this error. This happens both with /usr/bin/git and /opt/local/bin/git (from MacPorts):

cook47@rcmac (RC_bash_lib (master)): /usr/bin/git pull     
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

I have run Xcode and agreed to the license. I tried running xcode-select --install and got another error:

cook47-a@rcmac (current_projects): sudo xcode-select --install
Password:
xcode-select: error: no developer tools were found, and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'.

The remote repository is not a problem;
After googling this error, I downloaded the commandlinetools installer from Apple for OS X 10.9.5 and XCode 6.2. It installed successfully. However, git still is broken and xcode-select --install still gives the same errors.

I also tried xcodebuild -license and it does prompt me to agree to the agreement but after agreeing, no change. Still broken.

This has me completely stumped. This was working yesterday! I work in a government environment where it's possible an update changed something, so I cannot be sure exactly what might have changed.

Anyone know how I can get git working again? I tried nuking and reinstalling Xcode and the Command Line tools but to no avail. git from MacPorts and /usr/bin/git are both giving the same error message.

8
  • There are a ton of questions here. What's your main / biggest problem? Do you want a procedure to clean out all the things you tried? Are you just looking to get git working?
    – bmike
    Commented Sep 17, 2015 at 23:16
  • Actually, if you read my post a bit more carefully, you will find that there is only one question, literally speaking. "Anyone know how I can get git working again?" Of course, removing the idiom "Anyone know", the actual question is, "how can I get git working again?" I suspect that to get git working, I have to solve the xcode-select issue. I've tried to include enough information to help people give a useful answer and skip a lot of "have you tried this" kinds of responses.
    – Rich
    Commented Sep 18, 2015 at 0:25
  • Your title needs work if you just want git to work. Why mess up the text with all the Xcode junk. Edit in how many versions of git are installed and the path to the one you want to work. Help on editing is available at How to Ask
    – bmike
    Commented Sep 18, 2015 at 0:38
  • 2
    All details are relevant. Both versions of git, at /usr/bin/git and /opt/local/bin/git give errors that are clearly arising from XCode elements. However, I agree the title is confusing, thanks for pointing that out. there's nothing I can do to change it that I can tell, unfortunately.
    – Rich
    Commented Sep 18, 2015 at 3:27
  • 2
    Did you run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer after reinstalling Xcode? Also, does Xcode itself work (and build projects)? Does git work inside Xcode?
    – nohillside
    Commented Sep 18, 2015 at 6:44

5 Answers 5

27

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.

2
  • 3
    Indeed. In my case, I had Xcode installed on the server side, but I needed to re-authenticate the Apple ID for my developer account on that machine
    – Chris Beck
    Commented Oct 24, 2015 at 15:16
  • 1
    Super confusing, but this is what is was for me too. git worked fine locally until I tried to push, and then it said I had not agreed to the developer agreement. But I had... over, and over, and over again. Yes, it was the remote git that was complaining about the lack of agreement. Sigh. Commented Sep 22, 2023 at 18:38
2

I'm using El Capitan and got the same problem. Even running sudo xcodebuild -license didn't solve it. Then I tried by repairing the permission using

sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume / 

Problem solved then

2

I just had the same problem updating to Xcode 8. Like Tamil mentioned, all you have to do is quit Terminal, go into the App Store and into updates and click on the Xcode link. It takes you to Xcode in App Store, and then click on the "open" tab located to the left under the hammer in the Xcode Window. The License Agreement will pop up and just accept it. Then close out of the App Store and restart Terminal. Then when you go into any of your local git repos, your branch you were last on will appear again. And you are good to go!

-1

You need to open the application to install it...

I had the same problem where it showed me the same error after typing git init in terminal, I received the error message, even though it was installed.

All I did was open the XCode application. After opening, it prompted for the password and then actually installed the application, NOT just downloaded it. Which is stupid.

1
  • For anyone who is having this problem locally, this is probably enough for you to re-enable git.
    – kobejohn
    Commented Oct 1, 2016 at 14:10
-1

Even i had the same problem after installing the XCode. I closed the terminal and accepted the terms and conditions, then the error went away and my git started working normally.

1
  • Actually I didn't even need to close the terminal for git to start working gain. Commented Feb 3, 2017 at 8:56

You must log in to answer this question.

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