Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git::checkRefIsInMirror prevents https/git public usage #8932

Closed
pierrejoye opened this issue May 28, 2020 · 6 comments
Closed

Git::checkRefIsInMirror prevents https/git public usage #8932

pierrejoye opened this issue May 28, 2020 · 6 comments

Comments

@pierrejoye
Copy link

Using GitDowloader with the following config:

	$config->merge(['config' => [
        'secure-http' => true,
]);

I now get (just updated to latest stable composer release):

Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+MyStation+2020-05-28+1637

This is something that was not before. The git error happens in the Git::checkRefIsInMirror. Basically it seems it is not allowed for public repo anymore or something is wrong elsewhere.

Any thoughts?

You can see the usage here: https://github.com/FriendsOfPHP/pickle/blob/master/src/Package/Convey/Command/Git.php#L59

Or do you suggest an alternative way to use the download for any Git repo (public or not)?

@pierrejoye
Copy link
Author

btw, doing git clone https://github.com/beberlei/env.git ../testext in the console work just fine. So it could be some operations called in this method that requires now auth

@pierrejoye
Copy link
Author

Found the culprit. HOME env is not defined.

` - Installing env (master): PHP Notice: Undefined index: home in /home/pierre/projects/php/pickle/pickle/vendor/composer/composer/src/Composer/Config.php on line 279

Notice: Undefined index: home in /home/pierre/projects/php/pickle/pickle/vendor/composer/composer/src/Composer/Config.php on line 279
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos`

So another issue, minor, but the notice should not happen.

@Seldaek What behavior do you expect if HOME is missing? I can provide a PR

@pierrejoye
Copy link
Author

2nd issue is why HOME is missing or does not make it at this stage inside composer. As it is defined and available before the call to GitDownloader.

@pierrejoye
Copy link
Author

Any change regarding COMPOSER_HOME behavior when not set? It seems it was defaulting to ~/.config/composer before but latest do not, leading to the unset config HOME.

@Seldaek
Copy link
Member

Seldaek commented Jun 5, 2020

Not sure what this is all about, but Undefined index: home comes from a mis-initialized Config instance. It should be instantiated via Factory::createConfig

'home' => $home,

As for HOME env var, which is something else, it needs to be defined or COMPOSER_HOME needs to be defined, as per

protected static function getHomeDir()

I guess you figured it out somehow tho, but I'd suggest perhaps switching to Composer\Factory still.

Can this be closed otherwise?

@pierrejoye
Copy link
Author

I use the later to fix it, including the COMPOSER_HOME check.

It looks, if I understand you correctly, like it should rely on Factory::createConfig only to be clean. I will update the code accordingly.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants