Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete folder in GitLab using console

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 .

like image 538
AlbAlbatros Avatar asked Sep 12 '16 18:09

AlbAlbatros


2 Answers

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.

like image 92
Schwern Avatar answered Sep 21 '22 03:09

Schwern


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.

like image 44
Satheesh K Avatar answered Sep 24 '22 03:09

Satheesh K