I created a repo in the wrong folder. Meaning the User folder in OS where all the user folders are from pics, videos to documents. So I pushed that all to gitHub without knowing and now I can't create a repo anymore because the files that I work with are in the documents folder, which is inside the User Folder. And it will imply that I'm creating a repo within a repo. So when I go to terminal and I run git status, it shows me this:

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 2 and 4 different commits each, respectively.
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#   deleted:    Documents/m3/m3---Best-Game-Ever
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/CCLab_2/cclab_sketch_1/src/Boxes.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/CCLab_2/cclab_sketch_1/src/Boxes.h
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/ball_bouncing/Ball.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/ball_bouncing/Ball.h
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/bouncing_ball_classes/src/ball.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/bouncing_ball_classes/src/ball.h
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround.h
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround2.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/ms_final/src/backGround2.h
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround.h
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround2.cpp
#   deleted:    Documents/of_v0072_osx_release/apps/myApps/mySketch/src/backGround2.h
#   deleted:    README.md
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#   .Trash/
#   .bash_history
#   .dropbox/
#   .openmdao/
#   .ssh/
#   Documents/2nd_semester/
#   Documents/Arduino/
#   Documents/OpenMDAO/
#   Documents/Personal/
#   Documents/T.A/
#   Documents/gitHub/
#   Documents/mySite/
#   Documents/openFrameworks/
#   Documents/resources/
#   Documents/webcam-pulse-detector-master/
#   Dropbox/
#   Library/
#   Music/
no changes added to commit (use "git add" and/or "git commit -a")

Needless to say I'm never able to pull anything. It says that everything is up to date. At certain point I had a repo that uploaded those folders without the files to gitHub but I deleted that.

Any suggestions?

2 Answers 2


First things first:

  1. Delete the Github remote repository where you uploaded your user folder (you don't want this to be public)
  2. Delete the local repository in your user folder.

    # Be careful, dangerous command, it will erase your repository 
    # Make sure that you run this from the right folder 
    rm -rf .git

Now, if your local repositories bellow Documents start working again you are done. Else, delete and clone each one of them, one by one (of course that this will discard both uncommitted changes and commits that you have not previously pushed).

 cd ~/Documents/gitHub/
 # example, and again, be careful, it will erase your entire folder
 rm -rf repositoryA
 git clone git://github.com/myUser/repositoryA.git
 rm -rf repositoryB
 git clone git://github.com/myUser/repositoryB.git 
 # And so on 
  • You sir just saved the day!! So I'm guessing that whenever I want to delete something manual and get rid of it completely I have to re -rf .git
    – Mauricio Sanchez
    May 23, 2013 at 22:30
  • 2
    Removing the .git folder will remove the repository :). If you want to get rid of a local repository, this is the way to go.
    – Anthony Accioly
    May 23, 2013 at 22:35

T delete the .git folder in mac os recursively, go to the root folder of your project which contains .git folder and use:

find . | grep .git | xargs rm -rf

to remove its contents and itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy