Create a Private Github Repository

Store the GitHub Token in Jenkins Credentials

Goto Jenkins dashboard, click on New Item
Enter the Maven project name hello-world-maven-project-private, select Maven project, and then click OK

Select Source Code Management -> Git
Enter your Private GitHub repository https URL

If you are not selecting the credentials, you will see the above error

Select the created credential github-credential under Credentials section
Enter the GitHub branch name main under Branch Specifier and then click Save

Build the Maven project and check the logs in Console Output, you can see the credential github-credential is used to clone the Private Github repository