GitHub Error: Permission denied on status

自闭症网瘾萝莉.ら 提交于 2021-02-19 08:45:39

问题


I am having trouble creating and accessing my first git repository. I am following the Front-End Javascript Frameworks: Angular course on Coursea, and am running into some issues. The major issue seems to be that Permission is denied when Git tries to access the file I want to edit. Does anybody know how to fix this?

$ git init

Reinitialized existing Git repository in C:/Users/megan/.git/


$ git status

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

On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .bash_history
        .gitconfig
        3D Objects/
        AppData/
        Contacts/
        Downloads/
        Favorites/
        IntelGraphicsProfiles/
        Links/
        MicrosoftEdgeBackups/
        Music/
        NTUSER.DAT
        NTUSER.DAT{1c3790b4-b8ad-11e8-aa21-e41d2d101530}.TM.blf
        NTUSER.DAT{1c3790b4-b8ad-11e8-aa21-e41d2d101530}.TMContainer00000000000000000001.regtrans-ms
        NTUSER.DAT{1c3790b4-b8ad-11e8-aa21-e41d2d101530}.TMContainer00000000000000000002.regtrans-ms
        OneDrive/
        Saved Games/
        Searches/
        Videos/
        ntuser.dat.LOG1
        ntuser.dat.LOG2
        ntuser.ini

nothing added to commit but untracked files present (use "git add" to track)

回答1:


First, you can delete the C:/Users/megan/.git folder: it does not belong here, as it would force Git to consider a lot of system-managed subfolders it cannot access.

Second, initialize a new Git repository using a non-existing folder

cd C:/Users/megan
git init newRepo
cd newRepo

In that (empty, beside .git/) folder, you can start creating files, git add ., git commit -m "new commit"

See git init:

If you provide a directory, the command is run inside it.
If this directory does not exist, it will be created.



来源:https://stackoverflow.com/questions/56614164/github-error-permission-denied-on-status

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