Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于验证github凭据的Shell脚本_Git_Shell_Github - Fatal编程技术网

用于验证github凭据的Shell脚本

用于验证github凭据的Shell脚本,git,shell,github,Git,Shell,Github,我有shell脚本,我正在将主分支克隆到某个目录中。但是,一旦我在指定目录中成功克隆了主分支,我还有其他步骤要执行。下面的命令是否会返回一些true | false,以便我执行其他步骤 git clone -b master https://github.com/someuser/project.git /path/to/dir 我有其他办法,但想知道是否有这种可能性 谢谢 git clone命令成功时使用退出代码0,失败时使用非零, 就像任何表现良好的程序一样。 您可以在条件语句中使用此选

我有shell脚本,我正在将主分支克隆到某个目录中。但是,一旦我在指定目录中成功克隆了主分支,我还有其他步骤要执行。下面的命令是否会返回一些true | false,以便我执行其他步骤

git clone -b master  https://github.com/someuser/project.git /path/to/dir
我有其他办法,但想知道是否有这种可能性


谢谢

git clone命令成功时使用退出代码0,失败时使用非零, 就像任何表现良好的程序一样。 您可以在条件语句中使用此选项,例如:

if git clone -b master repourl /path/to/dir; then
    # clone successful -> run setup script
else
    echo fatal: could not clone repo
fi