How to delete folder in GitLab using console

天涯浪子 提交于 2020-02-28 06:14:05

问题


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

but it still does not delete the folder in my GitLab repository.

I have also tried this :

git rm -r --cached src

and none of them seems to work for me .


回答1:


Git doesn't track directories, only their contents. But git rm -r src should have done it. Here's possible things to check.

Was the git push successful? If not, then the remote will not be updated.

Double check that origin is what you think it is with git remote -v.

Double check that you're looking at the right branch, 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.

If after you've done all that and are still flummoxed, contact Gitlab about it.

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.




回答2:


Just delete folder from your local system then add all, commit, then push origin master.




回答3:


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.

So I think we can do this with WEB IDE.



来源:https://stackoverflow.com/questions/39456295/how-to-delete-folder-in-gitlab-using-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!