Change name of folder when cloning from GitHub?

GitGithub

Git Problem Overview


When I clone something from Github, it creates a folder with the same name as the app on my computer. Is there a way to change the name?

For example, doing this clone creates a long "sign-in-with-twitter" folder:

git clone https://github.com/sferik/sign-in-with-twitter.git

I know I can rename the folder after, but I'm wondering if there's a way to rename it as it comes in by adding an option at the end of the statement. For example,

git clone https://github.com/sferik/sign-in-with-twitter.git  as 'signin'

the problem is that I'm cloning some apps multiple times in order to tweak some of the settings to get it to work, and if there's a problem, I delete the folder. But, I'm worried that some of the gems remain installed even though I've deleted the folder.

Git Solutions


Solution 1 - Git

You can do this.

git clone https://github.com/sferik/sign-in-with-twitter.git signin

# or

git clone [email protected]:sferik/sign-in-with-twitter.git signin

refer the manual here

Solution 2 - Git

git clone <Repo> <DestinationDirectory>

Clone the repository located at Repo into the folder called DestinationDirectory on the local machine.

Solution 3 - Git

In case you want to clone a specific branch only, then,

git clone -b <branch-name> <repo-url> <destination-folder-name>

for example,

git clone -b dev https://github.com/sferik/sign-in-with-twitter.git signin

Solution 4 - Git

Here is one more answer from @Marged in comments

  1. Create a folder with the name you want

  2. Run the command below from the folder you created

     git clone <path to your online repo> .
    

Solution 5 - Git

Arrived here because my source repo had %20 in it which was creating local folders with %20 in them when using simplistic git clone <url>.

Easy solution:

git clone https://teamname.visualstudio.com/Project%20Name/_git/Repo%20Name "Repo Name"

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
QuestionLeahcimView Question on Stackoverflow
Solution 1 - GitMLNView Answer on Stackoverflow
Solution 2 - GitMichael LeissView Answer on Stackoverflow
Solution 3 - GitgprathourView Answer on Stackoverflow
Solution 4 - GitBhawna JainView Answer on Stackoverflow
Solution 5 - GitJoshView Answer on Stackoverflow