How to fix the «Failed to execute git clone... 401 Unauthorized while accessing» issue?

Failed to execute git clone --no-checkout ‘
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’ && git fetch composer
error: The requested URL returned error: 401 Unauthorized while accessing https://code.dmit
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 URL instead of URL:

	"repositories": [
			"type": "composer",
			"url": ""

From now on, the usage of instead of URL is the recommended way.

See also: