Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mkdir: cannot create directory 'example': Permission denied

Tags:

git-bash

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?

like image 472
Munchinator6354 Avatar asked Jan 01 '23 18:01

Munchinator6354


2 Answers

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.

like image 164
VonC Avatar answered Jan 03 '23 06:01

VonC


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!

like image 24
Munchinator6354 Avatar answered Jan 03 '23 08:01

Munchinator6354