1

I am trying to undo a "git init" command in github shell on Windows 8.1.

When I write

rm -r .git

it says:

rm : Cannot remove item : You do not have sufficient access rights to perfoem this operation.

It prints it for many files.

Any ideas to solve this?

Achi Even-dar
  • 427
  • 1
  • 10
  • 20
  • No way around it: if you want to obliterate a repository, you have to delete its `.git` subdirectory. So the answer is: get the "sufficient access rights". – jub0bs Jan 15 '15 at 19:11

1 Answers1

1

Ok well, it just wrote it as an error, but when i have done "git init" again it initialized it, so apparently writing "rm -r .git" worked.
The project was also uploaded to github successfully (which is actually what I wanted to do in the first place, undo "git init" was just one of many "undo's" I had to do), so everything is great.

Achi Even-dar
  • 427
  • 1
  • 10
  • 20
  • 2
    `git init` can re-initialize an existing repo -- and it *doesn't* wipe out any commits you've made. Can you change the permissions on the `.git` directory? – Keith Thompson Jan 15 '15 at 19:33
  • I did 'git reset' and I think it wiped out the commits. I am not sure how to change the permissions of '.git' directory, but as I said, so far everything seems ok. Do you think it might be a problem in the future? – Achi Even-dar Jan 15 '15 at 22:59
  • I don't know. You created the `.git` directory by running `git init`, so you *should* be able to remove it. On a UNIX-like system, I'd suggest using `rm -rf` rather than `rm -r`. And in fact, on Linux git creates read-only files under `.git` when you commit things; probably somethings similar is happening on Windows. I think the important question is how to remove the directory. That might be a good question for http://superuser.com/ (though it's likely already been asked). Right-clicking on the folder might get you to a useful menu. – Keith Thompson Jan 15 '15 at 23:06