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

From: "Theodore Ts'o" <[email-masked]>
Date: Sun, 15 Jan 2023 10:45:19 -0500

On Fri, Jan 13, 2023 at 05:01:01PM -0500, Crls wrote:
> 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