git clone - 默认情况下如何在文件夹名称中保留.git

lkr*_*aav 0 git

来自man git-clone:

   <directory>
       The name of a new directory to clone into. The "humanish" part of the source repository
       is used if no directory is explicitly given (repo for /path/to/repo.git and foo for
       host.xz:foo/.git). Cloning into an existing directory is only allowed if the directory is
       empty.
Run Code Online (Sandbox Code Playgroud)

我想让我的git-clone默认显示名为"project.git"的非人性文件夹.怎么样?

编辑:应该已经指定了--bare repo不是这里的克隆目标.

Til*_*ill 5

你不需要外部脚本来包装它!这正是git别名的用途,例如我有一个名为的别名clonez.将以下内容添加到您的~/.gitconfig:

[alias]
    clonez = "!sh -c 'git clone $1 ${1##*/}' -"
Run Code Online (Sandbox Code Playgroud)

用法:

git clonez git://github.com/till/jsonlint.git
Run Code Online (Sandbox Code Playgroud)

完成.创建一个本地文件夹jsonlint.git.