gitcapistrano3

capistrano - git ls-remote -h doesn't have the git url


I'm new to using Capistrano. I set it up correctly, but when I run cap staging deploy I get this -

DEBUG [b678d5eb] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/myproj/git-ssh.sh /usr/bin/env git ls-remote -h  )
DEBUG [b678d5eb]    usage: git ls-remote [--heads] [--tags]  [-u <exec> | --upload-pack <exec>] <repository> <refs>...
DEBUG [b678d5eb] Finished in 0.325 seconds with exit status 129 (failed).

I think the git clone url should follow after the -h, but I'm not sure.

I'm using Capistrano 3.2.1. Here's my deploy.rb -

lock '3.2.1'
set :application, 'myproj'
set :repository, 'https://vrao@git.test.com/scm/~vrao/myproj.git'
set :scm_passphrase, 'blah'

Any help would be great.


Solution

  • git clone URL should follow after the -h, but I'm not sure.

    Indeed, and you have found why that URL was empty in your case (wrong capistrano version)

    And the usage message is, in this case (-h, meaning --heads, without URL) expected.

    This is documented with Git 2.25.2 (March 2020).
    Both "git ls-remote -h" and "git grep -h" give short usage help, like any other Git subcommand, but it is not unreasonable to expect that the former would behave the same as "git ls-remote --head" (there is no other sensible behavior for the latter).

    The documentation has been updated in an attempt to clarify this.

    See commit 1ff466c (27 Feb 2020) by Junio C Hamano (gitster).
    (Merged by Junio C Hamano -- gitster -- in commit cdef998, 11 Mar 2020)

    Documentation: clarify that -h alone stands for help

    We seem to be getting new users who get confused every 20 months or so with this "-h consistently wants to give help, but the commands to which -h may feel like a good short-form option want it to mean something else." compromise.

    Let's make sure that the readers know that git cmd -h (with no other arguments) is a way to get usage text, even for commands like ls-remote and grep.

    Also extend the description that is already in gitcli.txt, as it is clear that users still get confused with the current text.

    The git ls-remote documentation now includes:

    Note that git ls-remote -h used without anything else on the command line gives help, consistent with other git subcommands.

    And gitcli:

    Note that some subcommand (e.g. git grep -h xxx) may behave differently when there are things on the command line other than -h, but git subcmd -h without anything else on the command line is meant to consistently give the usage.