Leahcim
Leahcim

Reputation: 41929

Change Folder Name During Clone

When I clone something, it creates a folder with the same name as the app on my computer.

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

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

Is there a way to specify a custom name?

Upvotes: 790

Views: 444983

Answers (5)

MLN
MLN

Reputation: 15158

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 to the manual here

Upvotes: 1449

Bhawna Jain
Bhawna Jain

Reputation: 759

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> .
    

Upvotes: 17

gprathour
gprathour

Reputation: 15333

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

Upvotes: 23

Josh
Josh

Reputation: 4438

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"

Upvotes: 9

Michael Leiss
Michael Leiss

Reputation: 5670

git clone <Repo> <DestinationDirectory>

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

Upvotes: 87

Related Questions