Spurious error message: fatal: could not read Username for 'https://git.launchpad.net': terminal prompts disabled

Bug #1761821 reported by Steve Langasek
36
This bug affects 7 people
Affects Status Importance Assigned to Milestone
git-ubuntu
Triaged
Medium
Unassigned

Bug Description

[Triage Notes]

Launchpad returns a "401 Unauthorized" when fetching a git repository without authentication and the repository doesn't actually exist, since it may actually be a private repository and Launchpad doesn't want to leak that information.

In some cases, git-ubuntu tries to fetch from such a remote, and it's fine if it doesn't exist. But then git asks for your credentials. To suppress this, git-ubuntu sets GIT_TERMINAL_PROMPT=0. That works, but git still reports an "error" of the form "fatal: could not read Username for 'https://git.launchpad.net': terminal prompts disabled" even though it is safe to ignore. This gets passed on to the user, who gets misled.

[Original Description]

error message at the end of a 'git ubuntu clone cryptsetup':

fatal: could not read Username for 'https://git.launchpad.net': terminal prompts disabled

$ snap info git-ubuntu
name: git-ubuntu
summary: Ubuntu development git tooling
publisher: nacc
license: unknown
description: |
  Imports, clones, etc. a source package in a git tree
commands:
  - git-ubuntu
  - git-ubuntu.import-source-packages
  - git-ubuntu.man
  - git-ubuntu.merge-changelogs
  - git-ubuntu.reconstruct-changelog
  - git-ubuntu.self-test
  - git-ubuntu.source-package-walker
  - git-ubuntu.update-repository-alias
snap-id: VAGSRAriUyDDlqsLunShJTe7503Uw4GF
tracking: candidate
refreshed: 2018-03-02T13:47:36-08:00
installed: 0.7.4 (392) 105MB classic
channels:
  stable: 0.7.4+git16.0a79cbc (391) 104MB classic
  candidate: 0.7.4 (392) 105MB classic
  beta: ↑
  edge: 0.7.4+git28.50ce40e (411) 115MB classic
$

The version numbers seem confusing, I would expect 0.7.4+git16.0a79cbc to be newer than 0.7.4 but 0.7.4 has the later revision. Is the version on the candidate channel newer or older than the one on stable?

Revision history for this message
Nish Aravamudan (nacc) wrote : Re: [Bug 1761821] [NEW] fatal: could not read Username for 'https://git.launchpad.net': terminal prompts disabled

On Fri, Apr 6, 2018 at 11:00 AM, Steve Langasek
<email address hidden> wrote:
> Public bug reported:
>
> error message at the end of a 'git ubuntu clone cryptsetup':
>
> fatal: could not read Username for 'https://git.launchpad.net': terminal
> prompts disabled

Yeah, it's annoying, but we're living with it for now, because Git
doesn't let us differentiate between a non-existing and
not-viewable-due-to-permissions repository. And we don't want an auth
prompt here.

> $ snap info git-ubuntu
> name: git-ubuntu
> summary: Ubuntu development git tooling
> publisher: nacc
> license: unknown
> description: |
> Imports, clones, etc. a source package in a git tree
> commands:
> - git-ubuntu
> - git-ubuntu.import-source-packages
> - git-ubuntu.man
> - git-ubuntu.merge-changelogs
> - git-ubuntu.reconstruct-changelog
> - git-ubuntu.self-test
> - git-ubuntu.source-package-walker
> - git-ubuntu.update-repository-alias
> snap-id: VAGSRAriUyDDlqsLunShJTe7503Uw4GF
> tracking: candidate
> refreshed: 2018-03-02T13:47:36-08:00
> installed: 0.7.4 (392) 105MB classic
> channels:
> stable: 0.7.4+git16.0a79cbc (391) 104MB classic
> candidate: 0.7.4 (392) 105MB classic
> beta: ↑
> edge: 0.7.4+git28.50ce40e (411) 115MB classic
> $
>
> The version numbers seem confusing, I would expect 0.7.4+git16.0a79cbc
> to be newer than 0.7.4 but 0.7.4 has the later revision. Is the version
> on the candidate channel newer or older than the one on stable?

This is because snap/stable (in the repository) actually has some
backported bugfixes from way back when. That is git's interpretation
of the merge result.

I think for the forthcoming 0.8 release, I'm just going to hard reset
everything to the same commit in the repository, so all three channels
will start at the same point.

-Nish

Revision history for this message
Nish Aravamudan (nacc) wrote : Re: fatal: could not read Username for 'https://git.launchpad.net': terminal prompts disabled

cf LP: #1735098

Robie Basak (racb)
tags: added: clone
Revision history for this message
Robie Basak (racb) wrote :

I've bumped into this again in a branch adding a feature to prepare-upload to fetch first. If the fetch fails then we can just assume that the remote branch isn't prepare and that we need to push it, so we can ignore the failure of the fetch call. But Launchpad demands auth, so we have to set GIT_TERMINAL_PROMPT=0 to stop the user facing that, and then we get the same "fatal: could not read Username for 'https://git.launchpad.net': terminal prompts disabled" error again, which again is spurious.

description: updated
description: updated
summary: - fatal: could not read Username for 'https://git.launchpad.net': terminal
- prompts disabled
+ Spurious error message: fatal: could not read Username for
+ 'https://git.launchpad.net': terminal prompts disabled
tags: added: onboarding-ux prepare-upload
Changed in git-ubuntu:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.