Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pull server message : warning: url has no scheme IP:Port , fatal: credential url cannot be parsed IP:Port

Tags:

git

linux

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 :(

like image 242
Yosef Heryana Avatar asked Apr 23 '20 09:04

Yosef Heryana


3 Answers

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.

like image 93
dsteinkopf Avatar answered Nov 18 '22 17:11

dsteinkopf


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.

like image 3
Immi Avatar answered Nov 18 '22 16:11

Immi


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.

like image 2
VonC Avatar answered Nov 18 '22 17:11

VonC