Cannot access gradle.properties properties in external script plugin buildscript

I keep getting a ‘groovy.lang.MissingPropertyException: Could not get unknow property ‘gitUsername’ for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated’.

I am trying to add an external maven repository which has a plugin that I need. This is a private repository and so requires a username and password. These values are stored in the gradle.properties file. I want to use the properties defined in gradle.properties in the buildscript block in my external script plugin. To be clear, the properties seem to be found if I define the repository in build.gradle however I want to define it in an external script plugin.

This is my current setup:
build.gradle

buildscript {
  apply from: 'other.gradle', to: buildscript
}

other.gradle:

buildscript {
  repositories {
    maven {
      name = "GithubPackages"
      url = "maven.pkg.github.com/Sneakyguy6/Repo"
      credentials {
        username gitUsername //error
        password gitPassword  //error
      }
    }
  }
}

I am using gradle 6.6