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 trialSam Lillicrap
12,127 PointsGit code question
I'm on git repo basics, doing the first code challenge and I'm somehow stuck, can't see what I'm doing wrong:
"Oops! I just decided we're in the wrong folder. Let's remove the git repository we just created."
Answers I've tried:
``` rm ~/project_folder ```
``` rm ~/project_folder/.git ```
``` rmdir ~/project_folder```
``` rmdir ~/project_folder/.git ```
Apparently none of them would remove the git repo... I'd like to think they all would but there's only one possible answer for this quiz
Any ideas? :-)
6 Answers
Ben Rubin
Courses Plus Student 14,658 PointsYou're on the right track. The challenge assumes that you've created a git repository in your current directory, so you shouldn't specify a directory path in your rm command. Your second line of code is almost correct..
You also need to use the -r flag to remove a directory (such as the .git directory). Take a look at this link for examples of removing a directory http://www.computerhope.com/issues/ch000798.htm
Michael Reining
10,101 PointsSo what is the answer? I have tried about 20 different variations. This is a super frustrating quiz. :(
Here was my last attempt:
rm -r ~/project_folder/.git
I finally solved it but it is absolutely not clear that the terminal is assuming that the users is in the current directory. In fact, you list the project_folder directory in Q1 above which completely throws users off. Either accept both answers or make it very obvious via the terminal prompt of where the user is.
The final answer for those also frustrated and stuck just enter:
> rm -r .git
James Barnett
39,199 PointsSeems like that code correctness check is overly specific, the 2 versions you posted should both work equally well, I'd say that's a bug. Send an email to help@teamtreehouse.com to let them know about the bug you found.
Michael Reining
10,101 PointsDone. Overall I am loving Treehouse so happy to help.
Paul Graham
1,396 Pointsrmdir
only works on empty directories. The command you're looking for is rm -rf
(recursive and permissions flags). info rm
in terminal and read up on the flags, they are good to know.
The directory you need to remove to destroy the repo is the .git
in your project directory.
James Barnett
39,199 PointsCheck out http://ss64.com/bash/rm.html
You can use http://ss64.com/bash/ for all of your man page needs via the web.
Paul Graham
1,396 Pointsnice resource, I will mark this
I always kinda like man.he.net but this page would work on small screens.
James Barnett
39,199 PointsI really like that ss64 typically only includes the flags and adds in some examples. man.he.net is great if you need info that isn't on ss64.com
Oliver Simon
10,192 Pointsrm -r .git
MUZ140626 Anderson Hove
6,780 Pointsrm-r .git
Sam Lillicrap
12,127 PointsSam Lillicrap
12,127 PointsOkay great cheers I managed to solve it. I'm still a little confused as to why I have to use the -r flag to move directories but not files though?
Paul Graham
1,396 PointsPaul Graham
1,396 PointsRead the man page for
rm
, it talks all about it. If you remove a file, you're giving a specific location. A folder holds files, so you have to throw the recursive flag so it recursively deletes all child files.Ben Rubin
Courses Plus Student 14,658 PointsBen Rubin
Courses Plus Student 14,658 PointsIt's to make it less likely that you'll accidentally delete an entire directory.
Sam Lillicrap
12,127 PointsSam Lillicrap
12,127 PointsCheers guys :-)