Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone into home directory

$ git clone ssh://host/repo.git ~/
destination directory '/home/username/' already exists.

Can anyone tell me how to make this work? I'm trying to quickly be able to replicate common dev scripts and config.

like image 621
rich Avatar asked Feb 25 '12 12:02

rich


People also ask

How do I change the directory of a clone?

The fastest way to change the folder name when cloning a GitHub repository is to simply specify the name you want at the end of the git clone command. Here's a short video showing the entire process: When you're done downloading the repo do cd your-app-name to enter your directory with all the Create React App files.

Does git clone into current directory?

From git help clone : Cloning into an existing directory is only allowed if the directory is empty. So make sure the directory is empty (check with ls -a ), otherwise the command will fail.


2 Answers

This seems to work:

cd ~
git init
git remote add origin ssh://host/repo.git
git pull origin master
like image 197
rich Avatar answered Oct 14 '22 21:10

rich


The clone command creates a new directory when you pass a second argument:

$ git clone ssh://host/repo.git ~/your_directory

clone will create ~/your_directory. If the directory already exists it will give you the error you get.

like image 21
ouah Avatar answered Oct 14 '22 21:10

ouah