2014-08-28 107 views
1

是否有可能从github克隆没有完整的URL的git存储库?从github克隆git存储库没有完整的URL

例如:
当我要运行这个命令:git clone https://github.com/foo/bar.git
我想输入:git clone foo/bar

我在网上看到一个解决方案,但我无法找到它了。

回答

3

您需要安装hub工具,然后使github的shell别名。

+0

谢谢,这就是我一直在寻找! – mamiu 2014-08-28 09:43:12

3

如果你只是想做到这一点使用git你可以编辑你.gitconfig文件中加入一个网址别名,像这样:

[url "<actual url base>"] 
    insteadOf = <other url base> 

比如这个:

[url "https://github.com/"] 
    insteadOf = gh: 

那么你可以做:

git clone gh:foo/bar.git 

它不exacally你所要求的但是不得不安装另一个命令行工具。

多亏了git docsStefan Majewsky