Tampa
Tampa

Reputation: 78382

How to remove files from the GitHub repository?

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.

Upvotes: 15

Views: 30477

Answers (2)

LiMar
LiMar

Reputation: 2972

You should not do git add. That's all

git rm classes/file.pyc
git commit -m"bla bla bla"
git push

Upvotes: 29

David Okwii
David Okwii

Reputation: 7840

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

Upvotes: -1

Related Questions