Files
git/Documentation
Harald Nordgren 39c960270d push: suggest <remote> <branch> for a slash slip
When pushing the 'main' branch to the remote 'origin', i.e.,

    $ git push origin main

it is easy to mistakenly write

    $ git push origin/main

That is parsed as the repository to push to, and since 'origin/main'
is neither a configured remote nor a path it dies with:

    fatal: 'origin/main' does not appear to be a git repository

Often 'origin/main' does not exist as a repository, so the command
fails without doing any harm, but it gives no hint that a space was
meant instead of a slash and can leave the user puzzled.

When the argument is not an existing path or configured remote but
its part before the first slash names one, suggest the intended
'<remote> <branch>' form:

    $ git push origin main

The suggestion is shown as advice so it can be silenced with
advice.pushRepoLooksLikeRef.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-06-24 15:21:12 -07:00
..
2026-06-17 05:39:13 -07:00
2026-06-15 07:42:00 -07:00
2026-06-05 22:27:24 +09:00
2026-03-06 13:02:20 -08:00
2026-05-21 12:06:48 +09:00
2026-06-15 07:42:00 -07:00