As mentioned in MSDOC,
Azure DevOps Server 2019 and later versions support integration with GitHub Enterprise Server repositories only. Integration with other Git repositories is not supported.
If you are using Azure DevOps Server 2019 or 2020 versions, GitHub.com is not supported, you have to authenticate using GitHub Enterprise Server with PAT or GitHub credentials.
Log in to GitHub.com using the account or token referenced in the service connection and search for the repository URL directly:
https://github.com/<username>/<repository>
If the repository is private, check if the current token/user has access.
Try reauthenticating by creating a new service connection authorized with GitHub PAT (personal access token) to see if you still get the same error.
Update Your Pipeline to use the New Connection.