0

I have to stash files which are in my LINUX WSL folder. But when i try to run git stash i recieve this error:

error: open("cloudformation/deployStacks.sh"): Permission denied
fatal: Unable to process path cloudformation/deployStacks.sh
Cannot save the current worktree state 

I tried to run chmod u=rwx,g=r,o=r cloudformation ,

chmod u=rwx,g=r,o=r cloudformation/deployStacks.sh

chmod 777 cloudformation

But none of this worked. Maybe anyone knows how to solve this permission issue?

Karina Shulan
  • 161
  • 1
  • 9

1 Answers1

0

After some time of struglling i found way to do it sudo git stash worked just great!

Karina Shulan
  • 161
  • 1
  • 9
  • 2
    Well, if you have sudo privileges you can use it to change file permission in the first place. Using git with sudo is a horrible idea. – Asocia Apr 29 '22 at 16:32
  • @Asocia Why it's horrible idea ? – Karina Shulan May 02 '22 at 08:25
  • Because you will write/modify some files as root and you won't be able to use git without sudo again. – Asocia May 02 '22 at 12:02
  • This is **very** bad, as you're giving git sudo permissions, which means it could modify ANY files on your disk. You were on the right lines with `chmod`. See also [this answer](https://stackoverflow.com/a/34917354/979052) – Alicia Sykes May 02 '22 at 12:03