如何从GitHub存储库中删除文件? [英] How to remove files from the GitHub repository?

查看:228
本文介绍了如何从GitHub存储库中删除文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从本地repo中删除了python .pyc文件,我想我所做的是从远程github中删除。



我推送了所有更改。这些文件仍在回购站上,但不在我的本地计算机上。





 <$>我如何从github仓库中删除文件? c $ c> git rm classes / file.pyc 
git add。
git

甚至:

  git rm  - 缓存类/ file.pyc 

然后,当我尝试检出文件时,出现此错误。

 在此处输入代码错误:pathspec'classes / redis_ha.pyc '与git已知的任何文件都不匹配。 

我现在不知道还能做什么。截至目前,我的git repo已经完全损坏。 git add code>。这就是全部

  git rm classes / file.pyc 
git commit -mbla bla bla
git push


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.

解决方案

You should not do git add. That's all

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

这篇关于如何从GitHub存储库中删除文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆