Reputation: 3568
I've moved back from my work MBP to my home MBP. The work one allowed to run git commands without the need for sudo. But I'm finding this is a requirement on my home machine.
I would prefer to be able to run git
commands without sudo
.
I looked at the git commands in /usr/bin
, and they all have rwxr-xr-x
(755
), and are owned by root
and group wheel
. I suppose I could change this to rwxrwxrwx
(777
), but I'm wondering if there's a better way. I'm thinking of adding my user to the wheel
group; but would there be other side effects?
Upvotes: 8
Views: 11094
Reputation: 392
If you were prompted like this:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
And then you ran:
sudo git init .
After updating xcode license. Just remove the init and re-init w/o sudo
sudo rm -rf .git
git init .
This fixed my issue.
Upvotes: 4
Reputation: 332736
The permission on the git
executable are fine; there is no reason you should need to change that, or change your group.
It's more likely that the permissions on your Git checkout are wrong. If you accidentally checked it out with something like sudo git clone ssh://user@host/project.git
, or at some point you performed some kind of operation in the repository that caused some files to be owned by root, git
running under your account won't be able to write to those files.
Most likely, what you need to do is chown -R <user> myproject
in order to make your project owned by your own user account, rather than root.
Upvotes: 18