Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Getting Started With Git Working With Git Repositories

3,244 Points

cannot mkdir permission denied

Hi. I am on a mac.
When I type ~$which git (returns) /usr/local/git/bin/git

In this tutorial, the following is typed: treehouse ~$ git init my_first_repository (returns) Initialized empty Git repository in /home/treehouse/my_first_repository/.git/

When I type ~$ git init my_first_repository (returns) fatal: cannot mkdir my_first_repository: Permission denied

I checked my permissions and I have all permissions set for the user me. drwxr-xr-x 10 root wheel 340 Sep 22 16:13 . drwxr-xr-x 9 root wheel 306 Sep 22 16:13 .. -rwxr-xr-x 1 root wheel 1603772 Jun 29 16:15 git -rwxr-xr-x 1 root wheel 14728 Jun 29 16:15 git-credential-osxkeychain -rwxr-xr-x 2 root wheel 162429 Jun 29 16:15 git-cvsserver lrwxr-xr-x 1 root wheel 3 Sep 22 16:13 git-receive-pack -> git -rwxr-xr-x 2 root wheel 793020 Jun 29 16:15 git-shell lrwxr-xr-x 1 root wheel 3 Sep 22 16:13 git-upload-archive -> git -rwxr-xr-x 2 root wheel 806404 Jun 29 16:15 git-upload-pack -rwxr-xr-x 1 root wheel 344042 Jun 29 16:15 gitk

I have tried this command from many directories but I am unable to execute the command.

Can someone tell me which directory I need to be to continue with the tutorial - and using git ?


1 Answer

Try using sudo in front.

So instead of ~$ git init my_first_repository try ~$ sudo git init my_first_repository

Tried this and got

bash: sudo: command not found