Having issues adding files after installing Git

After successfully installing Git to my computer, I open the Git Bash and type in some test command lines to see if everything is working. One of the command lines I typed in was “git add .” and, gave an output of errors.

This is the error I get:

warning: could not open directory ‘AppData/Local/Application Data/’: Permission denied
warning: could not open directory ‘AppData/Local/History/’: Permission denied
warning: could not open directory ‘AppData/Local/Microsoft/Windows/INetCache/Content.IE5/’: Permission denied
warning: could not open directory ‘AppData/Local/Microsoft/Windows/Temporary Internet Files/’: Permission denied
warning: could not open directory ‘AppData/Local/Temporary Internet Files/’: Permission denied
warning: could not open directory ‘Application Data/’: Permission denied
warning: could not open directory ‘Cookies/’: Permission denied
warning: could not open directory ‘Documents/My Music/’: Permission denied
warning: could not open directory ‘Documents/My Pictures/’: Permission denied
warning: could not open directory ‘Documents/My Videos/’: Permission denied
warning: could not open directory ‘Local Settings/’: Permission denied
warning: could not open directory ‘My Documents/’: Permission denied
warning: could not open directory ‘NetHood/’: Permission denied
warning: could not open directory ‘PrintHood/’: Permission denied
warning: could not open directory ‘Recent/’: Permission denied
warning: could not open directory ‘SendTo/’: Permission denied
warning: could not open directory ‘Start Menu/’: Permission denied
warning: could not open directory ‘Templates/’: Permission denied
warning: LF will be replaced by CRLF in .bash_history.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in .vscode/argv.json.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in AppData/Local/Astro Gaming/ASTRO Command Center/Updates/updates.xml.
The file will have its original line endings in your working directory
error: open(“AppData/Local/Comms/UnistoreDB/USS.jtx”): Permission denied
error: unable to index file ‘AppData/Local/Comms/UnistoreDB/USS.jtx’
fatal: adding files failed

I tried 5 times to uninstall and reinstall Git and, I also tried changing the install path. In addition, I tried looking up my issue on Google and, I found a post on the Github community with my similar issue, however the issue was not resolved.

If you need more information, please let me know.

Thanks in advanced.

All those “permission denied” errors seem to indicate that Git was not installed the standard way, because as an installed application it should have sufficient permission to to access those folders.

The errors of the kind warning: LF will be replaced by CRLF in .bash_history. are quite odd, it seems that Git is seeing configuration files as parts of a repository.

Is there any chance that you have created a repository somewhere in your main OS drive (e.g. C:), either intentionally or by mistake? This could also explain the first error type, i.e. that Git is considering system and User folders as part of a repository.

As a general rule, under Windows, you should not create or clone repositories inside system or special folders (e.g. Desktop, Documents, etc.) for these will prevent Git from operating normally.

Git for Windows comes with its own installer, which is known to work fine if installed using default values.

I believe the issue is fixed. I used the command line to change the directory of the repository and, placed it in its own folder. Now, I am able to add files.

The new path is C:/gitcode. Would you recommend that new path, or should I change it?

In general (assuming you don’t want to work on only one piece software ever), you don’t want only one path. You can have as many Git repositories (created with git init or cloned from an exisiting one with git clone) as you want, each in its own directory. Where you want to place these directories on your system is up to you, just not inside each other (with the exception of submodules, a somewhat advanced topic).

The key thing is: You can use as many repositories (and thus directories) as you like. Just keep system data and anything you don’t want in the repository out of them. :slightly_smiling_face:

Oh okay, makes sense.

Thank you again for the tips.