[git] Does the target directory for a git clone have to match the repo name?

In other words, I have a repo up on Github called st3_packages (https://github.com/pitosalas/st3_packages).

I want to do a git clone and have it create a directory on my local computer called "Packages".
Is that possible?

This question is related to git github

The answer is


Yes, it is possible:

git clone https://github.com/pitosalas/st3_packages Packages 

You can specify the local root directory when using git clone.

<directory> 

The name of a new directory to clone into.
The "humanish" part of the source repository is used if no directory is explicitly given (repo for /path/to/repo.git and foo for host.xz:foo/.git).
Cloning into an existing directory is only allowed if the directory is empty.


As Chris comments, you can then rename that top directory.
Git only cares about the .git within said top folder, which you can get with various commands:

git rev-parse --show-toplevel git rev-parse --git-dir