git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git push --delete <url> <branch> fails if run outside a repository

From
Adam Dinwoodie <adam@dinwoodie.org>
Date
Jun 6, 2022, 08:05 UTC
Message-ID
<20220606080528.rfugporpazoujceq@lucy.dinwoodie.org>

When using `git push`, rather than specifying a remote by name, one can also specify a remote by URL, and this includes when the only operations being performed are to delete refs on the remote. This doesn't require any information about any local repository, but it fails unless the command is run from within an existing local Git repo.

This seems like a bug to me: there's no reason this shouldn't work. Clearly low priority, though, as this is a rare use case, and there's a simple workaround: just `cd` into any existing Git repo, or create a temporary empty repo to run the command from.

Simple test case attached; I've verified the behaviour the test script demonstrates on Git v2.36.1 on Cygwin, and on Git v2.34.1 (strictly, v2.34.1-1~bpo11) on Debian 11.

Cheers,
Adam
Next: Junio C Hamano
Message 1 of 2 in “git push --delete <url> <branch> fails if run outside a repository”
  1. Adam DinwoodieJun 6, 2022
  2. Junio C HamanoJun 6, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.