{"record":{"id":"e6588664895dfd58","repo":"composer/composer","slug":"the-http-protocol-for-github-is-not-available-anym","errorCode":null,"errorMessage":"The http protocol for github is not available anymore, update your config's github-protocols to use \"https\", \"git\" or \"ssh\"","messagePattern":"The http protocol for github is not available anymore, update your config's github-protocols to use \"https\", \"git\" or \"ssh\"","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Composer/Config.php","lineNumber":513,"sourceCode":"                    // convert string value to bool\n                    return $env !== 'false' && (bool) $env;\n                }\n\n                if (!in_array($this->config[$key], [true, false, 'stash'], true)) {\n                    throw new \\RuntimeException(\n                        \"Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash\"\n                    );\n                }\n\n                return $this->config[$key];\n\n            case 'github-protocols':\n                $protos = $this->config['github-protocols'];\n                if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {\n                    unset($protos[$index]);\n                }\n                if (reset($protos) === 'http') {\n                    throw new \\RuntimeException('The http protocol for github is not available anymore, update your config\\'s github-protocols to use \"https\", \"git\" or \"ssh\"');\n                }\n\n                return $protos;\n\n            case 'autoloader-suffix':\n                if ($this->config[$key] === '') { // we need to guarantee null or non-empty-string\n                    return null;\n                }\n\n                return $this->process($this->config[$key], $flags);\n\n            case 'audit':\n                $result = $this->config[$key];\n                $abandonedEnv = $this->getComposerEnv('COMPOSER_AUDIT_ABANDONED');\n                if (false !== $abandonedEnv) {\n                    if (!in_array($abandonedEnv, ListPolicyConfig::AUDITS, true)) {\n                        throw new \\RuntimeException(\n                            \"Invalid value for COMPOSER_AUDIT_ABANDONED: {$abandonedEnv}. Expected one of \".implode(', ', ListPolicyConfig::AUDITS).\".\"","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/composer/composer/blob/6ffc1177404d0c50119c22dde6564a380f4a82c9/src/Composer/Config.php#L495-L531","documentation":"Composer throws this when the 'github-protocols' config option resolves to 'http' as the first (preferred) protocol. The 'http' protocol for GitHub was removed for security reasons (plaintext credentials/traffic). The check runs in Config::process() for the 'github-protocols' key: if secure-http is on, 'git' is stripped, and if 'http' is then the first remaining entry, the error fires. Only 'https', 'git', and 'ssh' are permitted.","triggerScenarios":"Calling $config->get('github-protocols') (directly or transitively via any install/update/require command) when the config contains \"github-protocols\": [\"http\", ...] or when \"github-protocols\": [\"git\", \"http\"] with \"secure-http\": true (git gets stripped, leaving http first). Also triggered via `composer config github-protocols http`.","commonSituations":"Carrying over an old composer.json from a pre-2.x Composer era where http was allowed. Setting github-protocols globally via `composer config -g github-protocols http`. Copy-pasting a config snippet from an outdated tutorial.","solutions":["Run `composer config github-protocols https` (or include \"ssh\"/\"git\") to replace http with https.","Edit composer.json \"config\" -> \"github-protocols\" and change \"http\" to \"https\" (e.g. [\"https\", \"ssh\"]).","For global config: `composer config -g github-protocols https`.","Remove the github-protocols key entirely so Composer uses the secure defaults."],"exampleFix":"// before (composer.json)\n\"config\": { \"github-protocols\": [\"http\", \"https\"] }\n// after\n\"config\": { \"github-protocols\": [\"https\", \"ssh\"] }","handlingStrategy":"validation","validationCode":"// Validate github-protocols before reading the config\n$protos = $config->get('github-protocols');\n$allowed = ['https', 'git', 'ssh'];\nforeach ($protos as $p) {\n    if (!in_array($p, $allowed, true)) {\n        throw new \\InvalidArgumentException(\"Unsupported github protocol '$p'. Allowed: \" . implode(', ', $allowed));\n    }\n}","typeGuard":"// type-guard is not applicable; this is a config-value validation\nfunction isValidGithubProtocols(array $protos): bool {\n    return empty(array_diff($protos, ['https', 'git', 'ssh']));\n}","tryCatchPattern":"try {\n    $protos = $config->get('github-protocols');\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'http protocol for github')) {\n        // auto-fix the config then retry\n        $source->setConfigSetting('github-protocols', ['https', 'ssh']);\n        $protos = $config->get('github-protocols');\n    } else { throw $e; }\n}","preventionTips":["Never include 'http' in github-protocols; default to ['https', 'git', 'ssh'].","Run `composer config github-protocols` after editing composer.json to confirm valid values.","Avoid copy-pasting config snippets from sources older than Composer 2.x."],"tags":["config","security","github","network","composer"],"analyzedSha":"6ffc1177404d0c50119c22dde6564a380f4a82c9","analyzedAt":"2026-08-07T00:01:08.491Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}