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

Re: ctrl-z ignored by git; creates blobs from non-existent repos

From
Theodore Ts'o <tytso@mit.edu>
Date
Jan 15, 2023, 15:45 UTC
Message-ID
<Y8Qfj32h89hq5UD6@mit.edu>
In-Reply-To
<632d051b-d81b-b35d-0641-c2488a124810@gmail.com>
On Fri, Jan 13, 2023 at 05:01:01PM -0500, Crls wrote:
Show 6 quoted lines
> Ctrl-Z is ignored by git; Git-clone injects blobs even with non-existent
> repos
> 
> Steps to reproduce 1- git clone github whateverrepo/whatevernonexistentrepo
> or 1- git clone gitlab whateverrepo/whatevernonexistentrepo 2= Git prompts
> for a username

% git clone github whateverrepo/whatevernonexistentrepo fatal: repository 'github' does not exist

I think what you meant was:

% git clone https://github.com/whateverrepo/whatevernonexistentrepo Cloning into 'whatevernonexistentrepo'... Username for 'https://github.com':

> 3- Press Ctrl-Z to stop *git* from running either on the virtual console/tty
> *git* automatically creates blobs with directories and disregards

So it's not that Control-Z is being ignored. It's that by the time you see the prompt for "Username for 'https://github.com': ", the directories already exist. Try looking at whatevernonexistentrepo/.git as soon as the prompt shows up. You'll see that the .git directory has been greated.

Now, when you type ^Z, the git processes are stopped --- but the objects are created already.

Username for 'https://github.com': ^Z [1]+ Stopped git clone https://github.com/whateverrepo/whatevernonexistentrepo % ps aux | grep git tytso 5097 0.0 0.0 9736 4480 pts/0 T 10:41 0:00 git clone https://github.com/wha tytso 5098 0.0 0.0 9736 3992 pts/0 T 10:41 0:00 /usr/lib/git-core/git remote-htt tytso 5099 0.0 0.1 102332 16104 pts/0 T 10:41 0:00 /usr/lib/git-core/git-remote-htt tytso 5140 0.0 0.0 6332 2072 pts/0 S+ 10:43 0:00 grep git

The 'T' means that the processes are stopped.
> Expected: The same issue does not happen with other non-existent repos e.g.,
> git clone git.zx2c4/ it returns the message of fatal repo not found

So what's going on is that github.com is not returning a non-existent repo error; it's prompting for a username/password, as _if_ the repository exists. That's presumably to prevent disclosing information as to whether or not a private repository exists or not.

Once the authentication fails, git will remove the partially created repro, so it's really not a problem in practice.

Cheers,
						- Ted
Previous: CrlsNext: Jeff King
Message 2 of 7 in “ctrl-z ignored by git; creates blobs from non-existent repos”
  1. CrlsJan 13, 2023
  2. Theodore Ts'oJan 15, 2023
  3. Jeff KingJan 15, 2023
  4. CrlsJan 15, 2023
  5. Jeff KingJan 15, 2023
  6. CrlsJan 17, 2023
  7. Junio C HamanoJan 16, 2023

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.