Munchinator6354
Munchinator6354

Reputation: 81

mkdir: cannot create directory 'example': Permission denied

I am trying to create a new directory.

Munch@DESKTOP-J0U63F0 MINGW64 /
$ ls
bin/  etc/           LICENSE.txt  ReleaseNotes.html  unins000.exe*
cmd/  git-bash.exe*  mingw64/     tmp/               unins000.msg
dev/  git-cmd.exe*   proc/        unins000.dat       usr/

Munch@DESKTOP-J0U63F0 MINGW64 /
$ mkdir example
mkdir: cannot create directory ‘example’: Permission denied

I expected no error, and to be able to then type ls again to view the new directory listing, and see "example" as one of the directories. See in video Prework: Git Bash Part 1 at 02:05. Instead I am getting the permission denied error. Why is my permission denied? And how do I correct this?

Upvotes: 5

Views: 57415

Answers (3)

Hùng Nguyễn
Hùng Nguyễn

Reputation: 629

Check the permission of the folder where you start Git Bash. The error showed that you did not have permission to perform that. There are some solutions to this.

  1. Use cd to change your directory to other hard drive rather than C (or may be to C:/path/to/your/user)
  2. Change the permission of current folder to full control (use pwd command to show your current directory) ...

Upvotes: 0

Munchinator6354
Munchinator6354

Reputation: 81

Upon speaking with a coder friend of mine, apparently on Windows 10, on my new laptop my primary account is not automatically set to run programs as administrator by default. I simply had to right click on the program and click "run as administrator". Once I did that, I was able to use the mkdir input as desired.

See this link for more info on the subject of default running programs as administrator: https://www.cnet.com/how-to/always-run-a-program-in-administrator-mode-in-windows-10/

Thanks all for your answers/input!

Upvotes: 3

VonC
VonC

Reputation: 1324606

MINGW64 means a Git for Windows installation.

'/' means "where Git is installed (which could be in C:\Program Files\Git, and C:\Program Files itself could be restricted in term of modification)

Try:

cd
mkdir example

cd will take you to $HOME, which is by default /c/Users/<YourLogin>: you can write there.

Upvotes: 7

Related Questions