Search code examples
windowsgit

git add <filename> not working


When i am typing

git add *.c

the error shown is

warning: could not open directory 'AppData/Local/Application Data/': 
Permission denied
warning: could not open directory 'AppData/Local/ElevatedDiagnostics/': 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 d                                                                                                          enied
warning: could not open directory 'AppData/Local/Microsoft/Windows/INetCache/Low/Content.IE5/': Permissi                                                                                                          on denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/Temporary Internet Files/': Permissio                                                                                                          n 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
      0 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
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 .atom/packages/script/examples/colored_diagnostics.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .atom/packages/script/examples/hello.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .atom/recovery/stringdel-c5a98d.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in AppData/Local/Programs/Python/Python36-32/Lib/site-packages/nump                                                                                                          y/distutils/mingw/gfortran_vs2003_hack.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in AppData/Local/Programs/Python/Python36-32/Lib/site-packages/nump                                                                                                          y/f2py/src/fortranobject.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in AppData/Local/Programs/Python/Python36-32/Lib/site-packages/nump                                                                                                          y/f2py/tests/src/array_from_pyobj/wrapmodule.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in AppData/Local/atom/app-1.27.0/resources/app/apm/node_modules/npm                                                                                                          /node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in AppData/Local/atom/app-1.27.1/resources/app/apm/node_modules/npm                                                                                                          /node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in AppData/Local/atom/app-1.27.2/resources/app/apm/node_modules/npm                                                                                                          /node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c.
The file will have its original line endings in your working directory.
1241365 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
2219951 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
2611925 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
2758249 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
2990144 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
3176253 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
3360807 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
3523597 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
3746325 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
3964192 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
4150814 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
4335693 [sig] bash 22680! sigpacket::process: Suppressing signal 18 to win32 process (pid 23616)
warning: LF will be replaced by CRLF in Desktop/exploringBB-master/chp03/HelloWorldSleep.c.
....

Please help me. I do not know what to do just to add a file. My repository folder has some files that do not have permission. How do I change these permissions or should I change my repository folder> I'm currently working under windows.


Solution

  • Seems like you are trying to perform git operations inside your user directory. C:\Users\{user-name}

    Please make sure your git bash or cmd points to correct folder.

    I had the same issue and by navigating to correct folder it worked fine for me

    As a suggestion use cd foldername then again cd foldername to navigate