Change the name of a git repository on the local machine

I have a git repository in a remote repository named site.git. I want to create a local repository in a subdirectory site/www/. When I simply clone the repository to the www directory, I get site/www/site.

How can I set up my local repository without the extra directory?

  • How can I tell whether the current working directory is ignored by Git?
  • Git: repo contains an empty directory - what happens?
  • How can I move the root of my git repository?
  • Bitvise SSH + Git + initial directory
  • How Github or any other cloud based repository services(Gitlab, Bitbucket) store source code files and directories?
  • Git does not recognize new folder adds and its sub directories
  • How to structure a python projects with shared sub apps using git and buidout without symbolic links
  • Can Angular 2 components be externalised?
  • pip: pulling updates from remote git repository
  • Git won't add any files - just an empty directory
  • Strange Git behavior when checking out HEAD (and variants) on Windows
  • Revert before cleanup?
  • 2 Solutions collect form web for “Change the name of a git repository on the local machine”

    cd site/www
    git clone site.git .

    A similar question has already been asked and there is the perfect answer:

    How do you clone a git repository into a specific folder?

    I will give the simplest solution. Use the command:

    git clone <repository> [<directory>]

    Link to documentation: git-clone

    Git Baby is a git and github fan, let's start git clone.