如何使用控制台删除 GitLab 中的文件夹 [英] How to delete folder in GitLab using console
问题描述
我在我的 GitLab 存储库中错误地创建了一个名为 src
的文件夹,现在我想删除这个文件夹.我尝试了几种删除它的方法,但我只能在本地删除它,但不能在我的 GitLab 存储库中删除.这个文件夹还在那里,我想摆脱它.这些命令我都试过了
I have wrongly created a folder named src
in my GitLab repository and now I want to delete this folder. I have tried several ways to delete it but I am able only to delete it locally but not in my GitLab repository. This folder is still there and i want to get rid off it. I have tried those commands
git rm -r src
git commit -m "Remove directory"
git push -u origin master
但它仍然没有删除我的 GitLab 存储库中的文件夹.
but it still does not delete the folder in my GitLab repository.
我也试过这个:
git rm -r --cached src
它们似乎都不适合我.
推荐答案
Git 不跟踪目录,只跟踪它们的内容.但是 git rm -r src
应该已经做到了.以下是可能需要检查的事项.
Git doesn't track directories, only their contents. But git rm -r src
should have done it. Here's possible things to check.
git push
成功了吗?如果没有,那么遥控器将不会更新.
Was the git push
successful? If not, then the remote will not be updated.
使用 git remote -v
仔细检查 origin
是否与您认为的相同.
Double check that origin
is what you think it is with git remote -v
.
仔细检查您是否正在查看正确的分支,master
.
Double check that you're looking at the right branch, master
.
如果您谈论的是 Gitlab 在 Web 浏览器中显示的内容,请为您的存储库创建一个新克隆并检查 src
是否仍然存在.如果不是,则可能是他们的网页显示有问题,也可能是缓存问题.
If you're talking about what Gitlab displays in a web browser, make a new clone of your repository and check if src
is still there. If it isn't then it's probably an issue with their web display, possibly a caching issue.
如果你做了所有这些之后仍然感到困惑,请联系 Gitlab.
If after you've done all that and are still flummoxed, contact Gitlab about it.
WRT git rm --cached
,--cached
指的是暂存区(也叫缓存,也叫索引).这是 git add
复制文件以构建下一次提交的地方.它存在于您的机器上,与您的问题无关.
WRT git rm --cached
, the --cached
refers to the staging area (also called the cache, also called the index). It's where git add
copies files to build up the next commit. It lives on your machine and has nothing to do with your problem.
这篇关于如何使用控制台删除 GitLab 中的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!