How to delete or change directory of a cloned git repository on a local computer

GitWindows XpMove

Git Problem Overview


Used git clone [url] to clone an open source project but it cloned to the

C:\Documents and Setings\$USER\project

What I wanted to do is clone the project to C:\project. I don't want to have duplicate project clones on my local machine.

How do I go about moving it to that location or deleting the existing repository(hopefully that's a correct term) and cloning it again?

I assume after deleting I should use something like the following to clone it to the desired location?

$ git clone [url] C:\project

Git Solutions


Solution 1 - Git

Just move it :)

command line :

move "C:\Documents and Setings\$USER\project" C:\project

or just drag the folder in explorer.

Git won't care where it is - all the metadata for the repository is inside a folder called .git inside your project folder.

Solution 2 - Git

You can just delete that directory that you cloned the repo into, and re-clone it wherever you'd like.

Solution 3 - Git

You could try this via SSH: rm -rf foldernamehere

Solution 4 - Git

I'm assuming you're using Windows, and GitBASH.

You can just delete the folder "C:...\project" with no adverse effects.

Then in git bash, you can do cd c\:. This changes the directory you're working in to C:\

Then you can do git clone [url] This will create a folder called "project" on C:\ with the contents of the repo.

If you'd like to name it something else, you can do git clone [url] [something else]

For example
cd c\:
git clone [email protected]:username\repo.git MyRepo

This would create a folder at "C:\MyRepo" with the contents of the remote repository.

Solution 5 - Git

  1. Go to working directory where you project folder (cloned folder) is placed.
  2. Now delete the folder.
  3. in windows just right click and do delete.
  4. in command line use rm -r "folder name"
  5. this worked for me

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGitNewbView Question on Stackoverflow
Solution 1 - GitdeanWombourneView Answer on Stackoverflow
Solution 2 - GittbthorpeView Answer on Stackoverflow
Solution 3 - GitdeanfloryView Answer on Stackoverflow
Solution 4 - GitcarletonView Answer on Stackoverflow
Solution 5 - GitNaveen MittalView Answer on Stackoverflow