Get-GitHubRepositoryBranch keeps throwing Access token error

Hi Guys,

Please I need assistance with a particular script meant to get the list of repos in a GitHub Org and get corresponding Branches for all of these repos

Set-GitHubAuthentication
$OrgName = Read-Host -Prompt ‘Input your Organization name’
$repo = Get-GitHubRepository -OrganizationName $OrgName
$repo | Format-Table -Property name, full_name, visibility, updated_at

$reponame = $repo.name

# ForEach loop to iterate each repo name and their corresponding branches
foreach ($repo in $reponame) {

  • Get-GitHubRepositoryBranch -OwnerName -RepositoryName “$reponame”*
  • }*

However it throws an error even after access token has been specified

The remote server returned an error: (404) Not Found.
404 | Not Found
Not Found | https://docs.github.com/rest/reference/repos#list-branches
This typically happens when the current user isn’t properly authenticated. You may need an Access Token with additional scopes checked.
RequestId: 2E37:7D8A:F5F6D9:20FB8CC:618CF09C
At C:\Program Files\WindowsPowerShell\Modules\PowerShellForGithub\0.16.0\GitHubCore.ps1:557 char:9

  •     throw $newLineOutput
    
  •     ~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : OperationStopped: (The remote serv…0FB8CC:618CF09C:String) , RuntimeException
    • FullyQualifiedErrorId : The remote server returned an error: (404) Not Found.
      404 | Not Found
      Not Found | https://docs.github.com/rest/reference/repos#list-branches
      This typically happens when the current user isn’t properly authenticated. You may need an Access Token with additional scopes checked.
      RequestId: 2E37:7D8A:F5F6D9:20FB8CC:618CF09C

Please assist in checking what might be the issue.

Thanks!.