0

I am a beginner working on a windows computer, trying to push my project on git. When I try to run git init I get my permission denied. Link to my screen shot

It just says C:/Program Files/Git/.git: Permission denied . That is what happens when I use the git window.

When I use Command Prompt, I get as far as git add -A then it starts spamming the screen with

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 .AndroidStudio3.4/config/codestyles/Default.xml.
The file will have its original line endings in your working directory

then keeps on repeating the last two lines with variations. Even as I type this, it is still spamming. What should I do?

torek
  • 448,244
  • 59
  • 642
  • 775
  • It looks like you need to start with a basic-principles-of-Windows book, to learn about navigating through files and folders in the OS and how Windows handles file and folder permissions. The issues you're running into here aren't really anything to do with Git itself, just with using your computer. – torek May 15 '22 at 15:54
  • Once you do get into using Git, remember that unlike your OS, Git doesn't actually store *folders* at all: Git stores only files, but gives them long names that include (forward) slashes. Windows uses backwards slashes, e.g., `path\to\file.ext` is a folder named `path` containing a folder named `to`; the folder named `to` then contains a file named `file.ext`. Git will *translate* this into a Git *file* whose name is literally `path/to/file.ext` and store that file in each commit (once the file is what Git calls *tracked*). Git does understand the OS's folders, it just doesn't *store* them. – torek May 15 '22 at 15:55
  • This part of Git (storing only files, with long names with slashes in them) is pretty confusing, and before you can understand it, you need to have a solid grasp of your OS's treatment of files-and-folders. When you work with a commit in Git, Git will *extract* the *committed* files (stored in Git's form) into *usable* files. You then work with your OS with the usable form files, which are in fact files-in-folders. – torek May 15 '22 at 15:58
  • The fact that `git add` lists AppData means you've create a repository in your user folder. This is not advised, simply because of all the subfolders that exists that are operating system related, such as many of those listed as unavailable in your question. Are you sure you created the repository in the right location? – Lasse V. Karlsen May 15 '22 at 17:07

2 Answers2

-1

Run the console in administrator mode and try git git add . instead

  • I am sorry, but now it says fatal: not a git repository (or any of the parent directories): .git – Tigerbookworm May 15 '22 at 12:05
  • You need to run `git init` first and the `git add .` – Junior Batista May 15 '22 at 12:10
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 16 '22 at 00:20
-1

use the following command.

runas git add.
anonymous
  • 37
  • 2