Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Working With Remote Repositories Pushing and Pulling

Changed directory name, now it doesn't work

So I changed the directory name of the directory my origin repository is in. I had named it something different and decided I wanted to use the same names as in the video to keep things less confusing.

When I did this it seems to have lost the repository. I tried to fix it on my own and ended up deleting the repository completely and having to redo everything to get back caught up to this point.

Can someone tell me how I would fix this without hurting a project should I make this mistake in the future again?

1 Answer

After renaming the origin directory, cd into your cloned repository and run

git remote set-url origin /path/to/newdirectoryname

This will update git with the new location of your origin repository.

Thank you so much :)

Thank you so much :)