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

Authentication with e-mail address as user name for HTTPS remote

From
PAPatrick Atoon <patrick.atoon@gmail.com>
Date
Aug 31, 2013, 06:52 UTC
Message-ID
<CADZGgi9-nLpcaHQOevBnY9HZtkLD6Zn=gCZq8u5yefPV7gYaTg@mail.gmail.com>
Hello,
I run into a problem with command line git on Linux.

The remote git server I try to clone from uses HTTPS as a protocol and requires full fledged e-mail addresses for a user name in its authentication. In TortoiseGit (with winstore) or SourceTree, the user name and password are asked and stored. But on the command line I'm stuck, unable to provide the user name.

Here is what happens. First try cloning without specifying the user name:

---8<------------------------------------------------------- $ git clone https://git.server.com/git/test.git Initialized empty Git repository in /tmp/git/test/.git/ error: The requested URL returned error: 401 Authorization Required while accessing https://git.server.com/git/test.git/nfo/refs

fatal: HTTP request failed ---8<-------------------------------------------------------

I couldn't find a "--username" flag or something similar for the git command, so my next try was to incorporate the user name in the URL, basic auth style. The repo URL looks something like this:

https://user.email@emaildomain.com@git.server.com/git/test.git

Note the double "@" there, it is bound to cause trouble. This is what happened:

---8<------------------------------------------------------- $ git clone https://user.email@emaildomain.com@git.server.com/git/test.git Initialized empty Git repository in /tmp/git/test/.git/ Password: error: Couldn't resolve host 'emaildomain.com@git.server.com' while accessing https://user.email@emaildomain.com@git.server.com/git/test.git/info/refs

fatal: HTTP request failed ---8<-------------------------------------------------------

It appears the "@" was picked up as an indication that the URL contains the username, however the URL was split at the wrong position. The splitting algorithm doesn't seem to take into account that a user name might contain an "@".

My request: please modify command line git to support full fledged e-mail addresses as user names in HTTPS requests.

I'm not a C adept, still I browsed the code a bit and bumped into "transport.c"'s "transport_anonymize_url" method. I think that code could be modified to do a better job of splitting the URL, which might then avoid problems down the line.

Thanks for reading this far.
Regards,
Patrick
Next: Jeff King
Message 1 of 2 in “Authentication with e-mail address as user name for HTTPS remote”
  1. Patrick AtoonAug 31, 2013
  2. Jeff KingAug 31, 2013

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.