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

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

This question is related to git windows-xp move

The answer is


You could try this via SSH: rm -rf foldernamehere


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.


  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

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.


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


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to windows-xp

installing JDK8 on Windows XP - advapi32.dll error How to Create a script via batch file that will uninstall a program if it was installed on windows 7 64-bit or 32-bit How do I find files with a path length greater than 260 characters in Windows? Apache Maven install "'mvn' not recognized as an internal or external command" after setting OS environmental variables? How to access share folder in virtualbox. Host Win7, Guest Fedora 16? How to create ls in windows command prompt? How to fix an UnsatisfiedLinkError (Can't find dependent libraries) in a JNI project How to use random in BATCH script? How to delete or change directory of a cloned git repository on a local computer How do I manually create a file with a . (dot) prefix in Windows? For example, .htaccess

Examples related to move

Gradle - Move a folder from ABC to XYZ Moving all files from one directory to another using Python Move column by name to front of table in pandas PHP - Move a file into a different folder on the server How to move table from one tablespace to another in oracle 11g Batch file to move files to another directory Windows batch script to move files How to move files using FTP commands Moveable/draggable <div> How to move a marker in Google Maps API