Git add errors: Could not open directory: Permission Denied

风格不统一 提交于 2019-12-01 14:53:00

You are running Git subcommand on a unexpected directory.

Most of Git subcommand are path-dependent. In most cases these subcommand treats the current working directory as Git root, and do Git operations inside Git root.

For regular usage, we treat the root directory for code project as Git root. Multiple code project results in multiple folder, and multiple corresponding Git roots. Use current working directory to specify them.

The default current working directory is called Home directory, which is ~ or mostly /home/<user> or /root in *nix, or C:\Users\<user> (non-Administrator) or C:\Windows\System32 (Administrator) in Windows > 7 or C:\Documents and Settings\<user> in Windows <= XP.

If you didn't specify current working directory (with command cd), all the Git operations are operating your home directory. This can be harmful under some situations. Small disaster is just like what you met, big disaster can be something like you accidently uploaded your private file in GitHub or something equivalent after you realized that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!