git warning “unable to access permission denied” o

2019-02-26 20:20发布

问题:

I have a sub-directory called ".gitignore" in one of my directories called "Database", which I want git to ignore, so I listed it in my .gitingore file.

.gitignore:

    [Bb]in/
    [Dd]ebug/
    [Rr]elease/
    .gitignore/

When I perform a command like git status Database, i get the following warning:

warning: unable to access 'Database/.gitignore': Permission denied

Can anyone please help me understand what I can do to get rid of this warning?

PS: I verified folder permissions on both "Database" and ".gitingore" were the same.

PS: I am running git on Windows 8. I don't think this matters.

回答1:

I'm not sure what you're experiencing but I would imagine that having a folder called .gitignore is a bad idea. Git might be trying to open it and read it like a file as it needs to know the contents of .gitignore files.

Try calling it something else and then adding its name to a .gitignore file next to it in the directory.



回答2:

Copy your .gitignore file and paste it on your desktop. Then open it and make changes. Delete previous file in your folder and paste updated one.

Hidden files cannot be replaced or edited.



标签: git gitignore