Py学习  »  Git

如何在不指定项目名的情况下指定目标目录来进行git克隆?

Paalon • 6 年前 • 1788 次点击  

我使用macos和ubuntu。我想用git克隆某个项目 https://github.com/Project/project.git 到特定目录 $HOME/git . 我看到这一页: How do you clone a Git repository into a specific folder? ,但它需要显式指定其项目名称,如: git clone https://github.com/Project/project.git $HOME/git/project . 如何在不指定项目名称的情况下对其进行git克隆?

[add1]如果git克隆如下: git clone https://github.com/Project/project.git $HOME/git 然后我遇到了 fatal: destination path '/home/paalon/git' already exists and is not an empty directory. [add2]我想在 $HOME/吉特 目录。我想设定国家 ls $HOME/git 表现得像 project1/ project2/ project3/

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/39946
 
1788 次点击  
文章 [ 3 ]  |  最新文章 6 年前
CodeWizard eftshift0
Reply   •   1 楼
CodeWizard eftshift0    6 年前

我认为这是不对的。您可以克隆提供 任何 目录作为目标。它不必与项目名称匹配:

$ git clone https://github.com/eantoranz/bwv blahblah
Cloning into 'blahblah'...
remote: Enumerating objects: 221, done.
remote: Total 221 (delta 0), reused 0 (delta 0), pack-reused 221
Receiving objects: 100% (221/221), 62.45 KiB | 480.00 KiB/s, done.
Resolving deltas: 100% (150/150), done.`1
CodeWizard eftshift0
Reply   •   2 楼
CodeWizard eftshift0    6 年前

如何将git存储库克隆到特定文件夹中?

git clone命令可以按以下方式使用:

 git clone <url> <destination>

致命:目标路径 /home/paalon/git 已经存在并且不是空目录。

这是因为您已经有了具有给定名称的文件夹 /家/帕隆/吉特
删除“旧文件夹”并再次克隆,这次将所需路径添加到克隆命令中

phd
Reply   •   3 楼
phd    6 年前

分成两个命令:

cd $HOME/git
git clone https://github.com/Project/project.git

这样你只给这个项目命名一次。