DEV Community

Katie Kim
Katie Kim

Posted on

Permission Issues on MacOS with Git

Greetings, to those whom pondered here!

I am currently embarking a journey at Hack Reactor and wanting to catalog some of things I learn on my own or during that day. I hope that you will join me in this process!

This has been a bit of an inconvenience for me personally, has been permission denied in the terminal when using git. It appears that I was finally able to fix this today and I wanted to share this to anyone who may have experienced similar issues as I have.

Linux users, don't leave just yet! This should also apply to linux as well!

If you are receiving permission errors with the ~/.config directory, then it could mean that the permissions are restricted or it does not exist yet. These steps should help address these concerns.

  1. Open your terminal, and type in:

    
       cd ~/
    
    
    • cd - change directory
    • ~/ - the $HOME path (i.e. /Users/{username})
  2. We want to list all of our files and who currently owns the .config. In your terminal, type in:

    
       ls -all
    
    
    • ls - lists directory contents
    • -all - does not ignore entries starting with .
  3. Check to see if it is set to root. If it is set to root, then type in:

    
       sudo chown -R $(whoami) .config
    
    
    • sudo - super user do /soo·dow/. A command to override permission. Be cautious with this power!
    • chown - change file ownership
    • -R - to modify the permissions Recursively
    • $(whoami) - displays the current logged-in user.
    • .config - this is just the file name.

You can apply this to any situation where you need to change who owns the file!

Disclaimer! Please proceed with caution. I am not liable for any security/permission concerns or issues that you may run into. If there are concerns, please research before proceeding.

Top comments (1)

Collapse
 
moopet profile image
Ben Sinclair

What would cause your local .config directory to be owned by root?