如何使用控制台在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
似乎它们都不适合我。
and none of them seems to work for me .
推荐答案
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
。
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在网络浏览器中显示的内容,请对存储库进行新的克隆,然后检查 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屋!