git url作为命令 [英] git url as a command
本文介绍了git url作为命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在终端中输入git repo url时,它说:
When I enter a git repo url in terminal it says:
% https://github.com/chmln/sd.git
zsh: no such file or directory: https://github.com/chmln/sd.git
我希望 https://github.com/chmln/sd.git
充当命令,
git clone https://github.com/chmln/sd.git
cd sd
我该怎么做?
推荐答案
OP提供了有关用例的更多详细信息.值得专门解决此用例.当应该使用命令(在这种情况下为git clone)时,请考虑使用BASH_COMMAND(或$ _)作为ERR陷阱
OP provides more detail on use case. Worth addressing this use case specifically. When a command (git clone in this case) should be assumed, consider ERR trap with the BASH_COMMAND (or $_)
trap 'try_gc' ERR
function try_gc {
local x=$BASH_COMMAND
if [[ "$x" = https://* ]] ; then git clone "$x"; fi;
}
这篇关于git url作为命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文