Git commands require sudo for OSX

I returned from my MBP job to my home MBP. In work, it is allowed to run git commands without the need for sudo. But I believe that this is a requirement for my home car.

I would rather 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 belong to the root and group wheels. I suppose I could change this to rwxrwxrwx (777), but I wonder if there is a better way. I am thinking of adding my user to the wheel group; but will there be other side effects?

+6
source share
2 answers

Permissions on the git executable are fine; there is no reason why you will need to change this or change your group.

Most likely the permissions on your Git checkout are incorrect. If you accidentally checked this with something like sudo git clone ssh:// user@host /project.git or at some point you performed some operation in the repository, due to which some files will be owned by root, git works under your account, will not be able to write to these files.

Most likely, you need to make chown -R <user> myproject so that your project belongs to your own user account, not root.

+15
source

If you were asked the following:

Accepting the Xcode / iOS license requires administrator privileges, rerun the root account through sudo.

And then you run:

 sudo git init . 

After updating the xcode license. Just remove init and restart w / s sudo

 sudo rm -rf .git git init . 

This fixed my problem.

+4
source

Source: https://habr.com/ru/post/983263/


All Articles