14

Hello i want to clone and pull some git repo to my linux server , i have an issue when running : git clone and git pull in my server. it says : warning: url has no scheme IP:Port , fatal: credential url cannot be parsed IP:Port. i tried to set new url with this command : git remote set-url origin http://IP:PORT/my.Git.Server/API_WEBTOOL3.git. but it doesnt work the same error still appear. Please help my issues :(

6
  • I have the same problem. This "suddenly" (= since today) occurs in an environment where nothing (I know about) has recently changed... wait: My self-hosted gitlab-server has recently (auto) updated to 12.10. Maybe this is the source of the problem. Maybe also yours? Commented Apr 23, 2020 at 10:40
  • FYI: At least in my case in fact the URL is complete (https://...) AND git push and pull work just fine. Just this messages before the normal ouput. Commented Apr 23, 2020 at 11:11
  • maybe you should be more precise in your question: Add output of git etc. And maybe a bit more formatting for easier reading :-) Commented Apr 23, 2020 at 11:13
  • Can you please edit your question to include the output of git config -l as a code block? Commented Apr 23, 2020 at 23:11
  • ok i'm sorry my bad, i missed that one. bytheway i already update my question Commented Apr 24, 2020 at 7:22

3 Answers 3

27

Removing an empty line from ~/.git-credentials solved the problem for me.

I had the same problem using git on ubuntu and a git credential helper "store". The upgrade to git 1:2.17.1-1ubuntu0.7 (see here) brought the problem. This security update adds more strict checks of the credential URLs. It seems the empty line is misinterpreted as a bad URL.

Sign up to request clarification or add additional context in comments.

4 Comments

can u tell me more spesific sir ? what command should i run ?
Find where your credentials are stored: Use git config -l and find the line credential.helper=store.... If there is a filename then use this one, else it's ~/.git-credentials. Then open this file and remove all empty or other "useless" lines. BTW: It seems there is a patch for git which hopefully will by released soon: lore.kernel.org/git/20200427004640.GA28818@Carlos-MBP/T/…
@YosefHeryana if this helped you, please be so kind and do accept this as correct answer.
@YosefHeryana nano ~/.git-credentials, delete the last line, Ctrl+O to save and Ctrl+X to exit.
3

This should be solved with With Git 2.27 (Q2 2020).

Recent updates broke parsing of "credential.<url>.<key>" where <url> is not a full URL (e.g. [credential "https://"] helper = ...) stopped working: that has been fixed.

See commit 9a121b0, commit 6828e59, commit 21920cb (24 Apr 2020) by Johannes Schindelin (dscho).
(Merged by Junio C Hamano -- gitster -- in commit da05cac, 05 May 2020)

credential: handle credential.<partial-URL>.<key> again

Signed-off-by: Johannes Schindelin
Reviewed-by: Carlo Marcelo Arenas Belón

In the patches for CVE-2020-11008, the ability to specify credential settings in the config for partial URLs got lost. For example, it used to be possible to specify a credential helper for a specific protocol:

[credential "https://"]
    helper = my-https-helper

Likewise, it used to be possible to configure settings for a specific host, e.g.:

[credential "dev.azure.com"]
    useHTTPPath = true

Let's reinstate this behavior.

While at it, increase the test coverage to document and verify the behavior with a couple other categories of partial URLs.

And:

credential: optionally allow partial URLs in credential_from_url_gently()

Signed-off-by: Johannes Schindelin
Reviewed-by: Carlo Marcelo Arenas Belón

Prior to the fixes for CVE-2020-11008, we were _very_ lenient in what we required from a URL in order to parse it into a struct credential. That led to serious vulnerabilities.

There was one call site, though, that really needed that leniency: when parsing config settings a la credential.dev.azure.com.useHTTPPath.
Settings like this might be desired when users want to use, say, a given user name on a given host, regardless of the protocol to be used.


Finally:

With the recent tightening of the code that is used to parse various parts of a URL for use in the credential subsystem, a hand-edited credential-store file causes the credential helper to die, which is a bit too harsh to the users.

Demote the error behaviour to just ignore and keep using well-formed lines instead.

See commit c03859a (02 May 2020) by Carlo Marcelo Arenas Belón (carenas).
See commit 20b4964 (28 Apr 2020) by Junio C Hamano (gitster).
(Merged by Junio C Hamano -- gitster -- in commit 933fdf8, 08 May 2020)

credential-store: ignore bogus lines from store file

Reported-by: Dirk
Helped-by: Eric Sunshine
Helped-by: Junio C Hamano
Based-on-patch-by: Jonathan Nieder
Signed-off-by: Carlo Marcelo Arenas Belón

With the added checks for invalid URLs in credentials, any locally modified store files which might have empty lines or even comments were reported failing to parse as valid credentials.

(reported in this very page by the OP)

Instead of doing a hard check for credentials, do a soft one and therefore avoid the reported fatal error.

While at it add tests for all known corruptions that are currently ignored to keep track of them and avoid the risk of regressions.

1 Comment

thanks for the detailed explanation. adding the URL "dev.azure.com" to the section [credential "dev.azure.com"] in the file .gitconfig helped me to fix it
3

I had the same problem. What helped for me was the following:

With

git config -l

I found out that there was a setting

credential.[URL].username=[SOME-USERNAME]

I deleted this using

git config --unset credential.[URL].username

Then things worked again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.