Skip to content

Git Clone "fatal:

I'm trying to install yay, so I made a directory and in that directory I wrote the command

​

git clone https://aur.archlinux.org/yay.git

​

and I get back

​

fatal: could not create work tree dir 'yay' : Permission denied

​

I have googled alot, and I couldn't find really anything that worked for me.

​

I am really new to linux, and it worked on my Arch installment right before this one, and now when I tried to go thourg it again (so I know how to do it before I install it on my computer for reals) on Virtualbox, it didn't work.

​

edit: I tried it with a user under the wheel group, it has a $ before it.

0 points35 comments
Open on Reddit
About this post
Posted
Archived
Score
0 · 100% up
Kind
Text
ID
b92fim

Author

4
posts
37
comments
0
media
View profile

35 comments

My guess is that you created the directory as root and are now trying to run git clone as your normal user, where only root has permissions to write to the directory.

3 points

I just figured out that I made it again with sudo... And that I cant make directories without using sudo command, and that makes it root permission. I get so confused by all this tryin to wrap my head around this.

1 points

That just means you don't have permissions in the directory you're creating your subdirectories in, either. What directory are you trying to work in?

1 points

yeah, I thought that also. So I erased the directory as root and then I logged in with the non root user and mkdir a new folder. And, still the same problem.

1 points

Can you post a screenshot of the exact commands you're running and the outputs?

1 points

Based on the image you provided: https://imgur.com/xpWaB9q

As a regular user you are not allowed to write anywhere als than your home folder and it's subfolders1. Your homefolder is normally /home/YourUsername, mostly indicated as ~. You are trying to write somewhere else in your rootfolder (/). Change to your homefolder (just typing cd should do that) and try again. You won't need a programs folder. When you install a package through pacman or makepkg -si it will be installed in the correct directory, mostly /usr/bin.

1: You are allowed to some other directories like /tmp for example and you can set permission and ownership to directories with chown and chmod to be allowed to write to them, but usually you don't have to do this. Just stick to your homefolder.

3 points

yeah, I try to do that, it dosent work. Just get the same problem.

​

fatal: could not create work tree dir 'yay' : Permission denied

1 points

Try chmodding the directory. Something like chmod 644 or chown it

1 points

I will look up what chmodding is!

1 points

Why are you installing Arch? If you're having this much trouble with basic permissions, you're going to have a bad time. You'd be better off with Ubuntu or Mint.

4 points

Looks like you have made a folder as root, and therefore dont have write perms to the folder.

Do the following

  1. Do not be logged in as root

  2. mkdir ~/programs

  3. cd ~/programs

  4. git clone thing

1 points

What does the ~ mark do? Iv'e seen it been used before. I'm sorry if I ask questions that are extremely noob like.

1 points

Type 'pwd' in the directory you're working in, and share the output of that with us.

Also, type in 'echo $USER'.

Finally, if you can, go to the parent directory ('cd ..') and type 'ls -a' for us.

If you do this, we should be able to narrow it down significantly

1 points
unknown author

Add yourself to a git group

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.