0xPingo
0xPingo

Reputation: 2197

move git repo down a level/directory

Should be a really basic question, but I'm pretty stumped by it for some reason.

I have a project called generator-meteor-app, and it's located on my computer at /desktop/generator-meteor-app. I initialized a git repo in the generator-meteor-app folder, but when I pushed the files to github it's for some reason it is including my desktop folder. You can see it on my profile here.

How can I move the project down a level? I see some solutions on here, but they are for people using Java / C#. Thanks !

Upvotes: 2

Views: 2000

Answers (1)

mkasberg
mkasberg

Reputation: 17272

Clone your repository from github into a different location (so we don't accidentally mess something up on your actual desktop).

cd foo/bar
git clone ssh://... ./new-meteor-app

Now let's use git mv and git rm to fix it.

cd new-meteor-app
git mv desktop/generator-media-app/* .
git rm -r desktop
git commit

That should do it. Now you can push those changes to github. The safest thing to do might be to clone your repository again at this point and delete the one that included your desktop.

Upvotes: 1

Related Questions