gh auth login failing to authenticate (mkdir permission denied)

Viewed 820

Currently trying to link my GitHub account to my new 14in MacBook Pro (2021). When running:

gh auth login

getting the following error:

gh auth login                                  
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? Skip
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: 0EA1-6D8E
- Press Enter to open github.com in your browser...
failed to authenticate via web browser: mkdir /Users/myusername/.config/gh: permission denied

When I copy and paste the one-time code into my browser, GitHub says the authentication was successful. See screenshot:

screenshot of successful authentication on browser

1 Answers

As mentioned in your issue cli/cli issue 5013, the first thing to check is your permissions in /Users/myusername/ or /Users/myusername/.config

ls -alrth /Users/myusername/
ls -alrth /Users/myusername/.config

The OP William Cho confirms:

was able to fix using chown, and then chmod on .config to modify permissions.

Related