How to fix the «Failed to execute git clone... 401 Unauthorized while accessing code.dmitry-fedyuk.com» issue?

Failed to execute git clone --no-checkout ‘https://code.dmitry-fedyuk.com/m2e/currency-form
at.git’ ‘/home/anine/public_html/vendor/mage2pro/currency-format’ && cd ‘/home/anine/public
_html/vendor/mage2pro/currency-format’ && git remote add composer ‘https://code.dmitry-fedy
UK.COM’ && git fetch composer
error: The requested URL returned error: 401 Unauthorized while accessing https://code.dmit
ry-fedyuk.com/m2e/currency-format.git/info/refs
fatal: HTTP request failed

The problem could be because of a legacy Git version on your server.

Solution 1

So the first way to solve the problem is just to upgrade Git.

Solution 2

If the problem is not solved with Solution 1 (after Git upgrading), then use SSH authentication instead of HTTP authentication.
You need to register your SSH Key in the Mage2.PRO code repository.
Then redeclare the Mage2.PRO repository to the Composer, but use the https://mage2.pro/ssh URL instead of https://mage2.pro URL:

{
	"repositories": [
		{
			"type": "composer",
			"url": "https://mage2.pro/ssh"
		}
	]
}

From now on, the usage of https://mage2.pro/ssh instead of https://mage2.pro URL is the recommended way.

See also: