0

I accidentally pushed a couple folders to bitbucket that had .git folders in them because I cloned them using git clone.

enter image description here

I can't click these folders or go into them in bitbucket

what do I do to get rid of those I already used:

rm -rf .git 

for those two .git folders then:

git reset --hard ^HEAD
git push
git commit -a -m "Message"
git push

I also have tried setting the commit back one but that didn't work either. there are no submodule files for these I've also moved the folders from there directory and made another push yet they still apear.

MikaAK
  • 2,334
  • 6
  • 26
  • 53

1 Answers1

3

Those are not "folders with .git" you see on the bitbucket site.

Those are submodules.

And removing the .git and pushing won't change that, since:

To remove a submodule, see "How do I remove a Git submodule?" (git 1.8.5+):

git submodule deinit asubmodule    
git rm asubmodule
# Note: asubmodule (no trailing slash)
# or, if you want to leave it in your working tree
git rm --cached asubmodule

Then commit and push.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Tried this .gitmodule was never there in the first place. ran git ls-files --stage | grep 160000 with no results tried removing from cache and re pushing using -f and it didn't work – MikaAK Jun 06 '14 at 06:40
  • @Snowfiring if you were to clone your repo now, would you still see those entries? I don't have access to your repo to have a look myself apparently. – VonC Jun 06 '14 at 07:00
  • No they are not there if I clone, they seem to have deleted over night – MikaAK Jun 06 '14 at 16:16
  • Yep but for no reason I'm not quite sure how that worked, or why it took overnight to update those particular files – MikaAK Jun 06 '14 at 18:47
  • @Snowfiring I suspect the screenshot you have in your question doesn't reflect the HEAD (latest) of master, so maybe those submodule references were deleted since then, which means a fresh clone will work. – VonC Jun 06 '14 at 18:59