git 如何使用控制台删除 GitLab 中的文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39456295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to delete folder in GitLab using console
提问by AlbAlbatros
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
我src
在我的 GitLab 存储库中错误地创建了一个文件夹,现在我想删除这个文件夹。我尝试了多种方法来删除它,但我只能在本地删除它,而不能在我的 GitLab 存储库中删除它。这个文件夹还在那里,我想摆脱它。我试过这些命令
git rm -r src
git commit -m "Remove directory"
git push -u origin master
but it still does not delete the folder in my GitLab repository.
但它仍然没有删除我的 GitLab 存储库中的文件夹。
I have also tried this :
我也试过这个:
git rm -r --cached src
and none of them seems to work for me .
他们似乎都不适合我。
回答by Schwern
Git doesn't track directories, only their contents. But git rm -r src
should have done it. Here's possible things to check.
Git 不跟踪目录,只跟踪它们的内容。但git rm -r src
应该做到了。以下是可能需要检查的事项。
Was the git push
successful? If not, then the remote will not be updated.
是git push
成功的?如果没有,则不会更新遥控器。
Double check that origin
is what you think it is with git remote -v
.
仔细检查origin
你认为它与git remote -v
.
Double check that you're looking at the right branch, master
.
仔细检查您是否正在查看正确的分支,master
.
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 在 Web 浏览器中显示的内容,请创建一个新的存储库克隆并检查是否src
仍然存在。如果不是,则可能是他们的网络显示问题,可能是缓存问题。
If after you've done all that and are still flummoxed, contact Gitlab about it.
如果在完成所有这些之后仍然感到困惑,请联系 Gitlab。
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.
WRT git rm --cached
,--cached
指的是暂存区(也叫缓存,也叫索引)。它是git add
复制文件以构建下一次提交的地方。它存在于您的机器上,与您的问题无关。
回答by James Siva
Just delete folder from your local system then add all, commit, then push origin master.
只需从本地系统中删除文件夹,然后添加 all,提交,然后推送 origin master。
回答by Satheesh K
For me it worked with gitlab web IDE. I just deleted a folder and committed it and also I renamed my project's folder name.
对我来说,它适用于 gitlab web IDE。我刚刚删除了一个文件夹并提交了它,并且我重命名了我的项目的文件夹名称。
So I think we can do this with WEB IDE.
所以我认为我们可以用 WEB IDE 来做到这一点。