[英]How to git clone with specifying the destination directory without its project name?
I uses macOS and Ubuntu.我使用 macOS 和 Ubuntu。 I want to git clone a certain project
https://github.com/Project/project.git
to a specific directory $HOME/git
.我想将某个项目
https://github.com/Project/project.git
git 克隆到特定目录$HOME/git
。 I saw this page: How do you clone a Git repository into a specific folder?我看到了这个页面: 如何将 Git 存储库克隆到特定文件夹中? , but it requires to explicitly specify its project name like:
git clone https://github.com/Project/project.git $HOME/git/project
. ,但它需要明确指定其项目名称,如:
git clone https://github.com/Project/project.git $HOME/git/project
。 How can I git clone them without specifying its project name?如何在不指定项目名称的情况下 git clone 它们?
[Add1] If I git clone like: git clone https://github.com/Project/project.git $HOME/git
then I encountered fatal: destination path '/home/paalon/git' already exists and is not an empty directory.
[Add1] 如果我 git clone 像:
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] I want to clone git-managed projects under $HOME/git
directory. [Add2] 我想在
$HOME/git
目录下克隆git 管理的项目。 I want to set the state ls $HOME/git
shows like project1/ project2/ project3/
.我想设置状态
ls $HOME/git
显示像project1/ project2/ project3/
。
Split into 2 commands: 分为2个命令:
cd $HOME/git
git clone https://github.com/Project/project.git
That way you name the project only once. 这样,您只需将项目命名一次。
How do you clone a Git repository into a specific folder?
如何将Git存储库克隆到特定文件夹中?
The git clone command can be used in the following way: 可以通过以下方式使用git clone命令:
git clone <url> <destination>
fatal: destination path
/home/paalon/git
already exists and is not an empty directory.致命:目标路径
/home/paalon/git
已经存在且不是空目录。
This is due to the face that you already have folder with the given name /home/paalon/git
. 这是因为您已经拥有给定名称
/home/paalon/git
文件夹。
Delete the "old folder" and clone again, this time add the desired path to your clone command 删除“旧文件夹”并再次克隆,这次添加克隆命令所需的路径
I don't think that's actually correct. 我认为这不是正确的。 You can clone providing any directory as your target.
您可以克隆提供任何目录作为目标。 It doesn't have to match the project name:
它不必与项目名称匹配:
$ 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
git -C $HOME/git clone https://github.com/someorg/Boostnote.git
将创建$HOME/git/Boostnote
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.