GitHub wants you to use tokens to access private repositories (and other access-restricted stuff). The way to generate them is not obvious at first glance.
- User icon in upper right -> Settings
- Developer settings, all the way at the bottom
- Personal access tokens, at the bottom again
If you just want to read/write code then repo scope should be sufficient. If your repo has Github workflows in it then you will need the workflow scope as well.
To use the generated token, see Use token instead of password.