How to use Git commands without sudo?

Asked

Viewed 499 times

1

Whenever I need to use some commands like git pull, git stash, a message pops up that couldn’t perform the operation because the permission wasn’t enough. How do I make sure you don’t have to wear sudo?

  • The user you are using is not allowed to change the folders that these commands are trying to change. What folder are your files in? Try putting in a user folder.

  • tried to give the command "sudo -s" and the admin password.. that’s what you need ?

1 answer

3


You have two options:

1) Checkout as another user. ("git checkout ...").

2) Change the permission throughout the project so that the user you want can use the filesystem. (chown -R)

  • Really this, the second option was right!! I am working on a homologated machine and with Docker, so Docker set my user in the container with user id 1000, but my machine has an id generated by the company, when running the commands had not even permission... Thank you!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.