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

谁能告诉我如何使这项工作?我正在尝试快速复制常见的开发脚本和配置。

4

4 回答 4

32

这似乎有效:

cd ~
git init
git remote add origin ssh://host/repo.git
git pull origin master
于 2012-02-25T13:19:43.020 回答
2

当您传递第二个参数时,克隆命令会创建一个新目录:

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

clone将创建~/your_directory. 如果目录已经存在,它会给你你得到的错误。

于 2012-02-25T12:28:26.943 回答
1
cd ~
git clone ssh://host/repo.git

之后,您在/home/username/repo/目录中就有了项目

如果您想将项目放在不同的文件夹名称中(例如 'foo/')

mkdir ~/foo
cd ~/foo
git clone ssh://host/repo.git foo/
于 2012-02-25T12:22:55.373 回答
0

我会将存储库克隆到一个子目录中:

git clone ssh://your/git/repo.git ~/repo

并创建指向配置文件的符号链接:

ln -s ~/repo/.bashrc ~/.bashrc
于 2012-02-25T12:26:54.310 回答