[英]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.如何更改这些权限,或者我应该更改我的存储库文件夹> 我目前在 Windows 下工作。
Seems like you are trying to perform git operations inside your user directory.似乎您正在尝试在用户目录中执行 git 操作。 C:\\Users\\{user-name}
Please make sure your git bash or cmd points to correct folder.请确保您的 git bash 或 cmd 指向正确的文件夹。
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建议使用cd foldername
然后再次使用cd foldername
进行导航
You just need to delete log files.您只需要删除日志文件。
Use the command使用命令
rm -rf .git
It will solve your problem.它会解决你的问题。 Before entering this command remember one thing that it will clear all your log files and delete .git folder.在输入此命令之前,请记住一件事,它将清除所有日志文件并删除 .git 文件夹。
in my case, I solved this error by running the following commands:就我而言,我通过运行以下命令解决了此错误:
git init
git add -A
git Commit -a -m "your message"
Just change your directory where the actual files are located then list them (ls -l).只需更改实际文件所在的目录,然后列出它们(ls -l)。 You will find your file there.你会在那里找到你的文件。 once you done this your command will work fine git add <filename>
.完成此操作后,您的命令将正常工作git add <filename>
。
What I did is:我所做的是:
sarat@DESKTOP-9BPO08D MINGW64 /d
$ cd files1
sarat@DESKTOP-9BPO08D MINGW64 /d/files1
$ git init
Initialized empty Git repository in D:/files1/.git/
sarat@DESKTOP-9BPO08D MINGW64 /d/files1 (master)
$ ls -l
total 1
-rw-r--r-- 1 sarat 197609 396 May 25 21:15 Camera_Follow.cs
sarat@DESKTOP-9BPO08D MINGW64 /d/files1 (master)
$ git add Camera_Follow.cs
sarat@DESKTOP-9BPO08D MINGW64 /d/files1 (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: Camera_Follow.cs
Seems like you didn't initialised git on you folder,好像你没有在你的文件夹上初始化 git,
Start by:开始:
git init
git status
git add -A
it will work它会工作
确保您在正确的路径(文件夹)中,然后使用: git init git status
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.