GitHub CLI | Take GitHub to the command line
CLI manual gh exit-codes gh follows normal conventions regarding exit codes. If a command completes successfully, the exit code will be 0 If a command fails for any reason, the exit code will be 1 If a command is running but gets cancelled, the exit code will be 2 If a command requires authentication, the exit code will be 4 NOTE: It is possible that a particular command may have more exit codes, so it is a good practice to check documentation for the command if you are relying on exit codes to control some behavior.
See also gh