Skip to content
Sign upLog in
← Back to Community

git cant add file due to permissions! [REPOST]

Profile icon
Squirrel777

So basically I have almost everything resolved! That problem from yesterday? Solved! Which is good, but... what's that? Another permissions error! Oh boy. So basically I did git add ., but that didn't seem to work. I got this instead:

error: open("index.html"): Permission denied error: unable to index file 'index.html' fatal: adding files failed

Anyone know how to fix this?

Things I tried

So I have tried a couple of things... and none of them worked.

  1. git add --ignore-errors . source

  2. chmod 777 myFolder

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
SorenRood
Profile icon
Squirrel777
Comments
hotnewtop
Profile icon
Coder100

try sudo?

Profile icon
Squirrel777

That didn't seem to work, I already tried it, same for the other answer

@Coder100

Profile icon
Coder100

ok
maybe you made the files on window and you are using git on wsl

@Squirrel777

Profile icon
Squirrel777

yeah that's exactly what I did

@Coder100

Profile icon
Coder100

yeah no
oses protect their files from other oses lol
its called security

can't do that

@Squirrel777

Profile icon
Squirrel777
Profile icon
SorenRood

Ohhhhh, I see his problem now.

Profile icon
Coder100

ye
pretty dumb/smort right

@SorenRood

Profile icon
Coder100

but make sure the file isn't being 'used' (like an editor or smth)

so close any open editors.

Profile icon
SorenRood

You actually have to interact with git using the tab on the left side of the editor. I have not been able to get git commands in terminal to work either.

Profile icon
Coder100

r u sure this is replit env

@SorenRood

Profile icon
Squirrel777

I am using vs code, and you use the shell to use git commands not the terminal

@SorenRood

Profile icon
SorenRood

Oh I see. Have you added your ssh private key to github?

@Squirrel777

Profile icon
SorenRood
Profile icon
Squirrel777
Profile icon
SorenRood

@Squirrel777
You may have to cd /home/users//.ssh and then do ssh-keygen -t ed25519 to generate a new key. From there you want to open the .pub key by doing vim <key_name>.pub and then copying the public key into your github account.

Profile icon
SorenRood

@Squirrel777
the path is different if you are on windows. It would be:
image

Profile icon
Squirrel777

I already have an ssh key

@SorenRood

Profile icon
SorenRood

@Squirrel777
is the public key in your github account?

Profile icon
SorenRood

"permission denied" is usually a auth issue.

@Squirrel777

Profile icon
SorenRood

It might be an easy fix if you remove the .git file and try re-adding it to a new git repo.

@Squirrel777

Profile icon
SorenRood

Since it is the git add . that is erroring, not the git push.

Profile icon
SorenRood

I can help debug over discord if you want to DM me @ soren#1111

Profile icon
SorenRood

You can also just reclone as https instead of using ssh for now if you'd like

@Squirrel777
:

image