15

I deleted python .pyc files from my local repo and what I thought I did was to delete from remote github.

I pushed all changes. The files are still on the repo but not on my local machine. How do I remove files from the github repo?

I tried the following:

git rm classes/file.pyc
git add .
git 

and even:

git rm --cached classes/file.pyc

Then when I try and checkout the files I get this error.

enter code here`error: pathspec 'classes/redis_ha.pyc' did not match any file(s) known to git.

I now dont know what else to do. As of now I have a totally corrupted git repo.

nulltoken
  • 64,429
  • 20
  • 138
  • 130
Tampa
  • 75,446
  • 119
  • 278
  • 425
  • 3
    Did you `git commit` and `git push` after `git rm`? – Wooble Jun 20 '12 at 14:05
  • Duplicate of [How can I delete a file from git repo?](http://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-git-repo) –  May 24 '14 at 23:13

2 Answers2

29

You should not do git add. That's all

git rm classes/file.pyc
git commit -m"bla bla bla"
git push
Vasfed
  • 18,013
  • 10
  • 47
  • 53
LiMar
  • 2,822
  • 3
  • 22
  • 28
-1
git commit -am "A file was deleted"
git push
Vasfed
  • 18,013
  • 10
  • 47
  • 53
David Okwii
  • 7,352
  • 2
  • 36
  • 29
  • That will also commit any other changes to files already in index and in many teams is considered unsafe because of that. It is better to always check what is going to be commited – Vasfed Jan 27 '16 at 12:13