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.

2
  • 3
    Did you git commit and git push after git rm? Commented Jun 20, 2012 at 14:05
  • Duplicate of How can I delete a file from git repo? Commented May 24, 2014 at 23:13

2 Answers 2

29

You should not do git add. That's all

git rm classes/file.pyc git commit -m"bla bla bla" git push 
Sign up to request clarification or add additional context in comments.

Comments

-1
git commit -am "A file was deleted" git push 

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.