Skip to content

Accessing private repos #440

Closed
Closed
@vchav73

Description

@vchav73

I am trying to access a private repo using this code:

require_once 'vendor/autoload.php';
$client = new \Github\Client();
$client->authenticate(‘my_client_id’, ‘my_secret’, \Github\Client::AUTH_URL_CLIENT_ID);
print_r($repo = $client->api('repo')->show(‘my_org_id’, ‘my_private_repo’));

The above code always returns this:

PHP Fatal error:  Uncaught exception 'Github\Exception\RuntimeException' with message 'Not Found' in /home/prod/apps/analytics/server/vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php:86
Stack trace:
#0 /home/prod/apps/analytics/server/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php(34): Github\HttpClient\Plugin\GithubExceptionThrower->Github\HttpClient\Plugin\{closure}(Object(GuzzleHttp\Psr7\Response))
#1 /home/prod/apps/analytics/server/vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php(87): Http\Client\Promise\HttpFulfilledPromise->then(Object(Closure))
#2 /home/prod/apps/analytics/server/vendor/php-http/client-common/src/PluginClient.php(156): Github\HttpClient\Plugin\GithubExceptionThrower->handleRequest(Object(GuzzleHttp\Psr7\Request), Object(Closure), Object(Closure))
#3 /home/prod/apps/analytics/server/vendor/php-http/client-common/src/PluginClient.php(170): Http\Client\Common\PluginClient->Http\Client\Common\{closure}(Object(GuzzleHttp\Psr7\Re in /home/prod/apps/analytics/server/vendor/knplabs/github-api/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php on line 86

When I use a public repo it works fine. I've tried using both OAUTH application and personal access tokens but neither are working for me. Is anyone able to access private repos with this package?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions