Private Repository Access
GitHub User Token
In order to access a private repository in GitHub, you first need to create a personal access token for your GitHub Account. Please follow these steps to create one for your own account.
Log into your account.
In the upper-right corner of any page, click your profile photo, then click Settings.
In the left sidebar, click Developer settings.
In the left sidebar, click Personal access tokens.
Click Generate new token.
Give your token a descriptive name.
Select an expiration date and also access permission for the token, such as 'repo'
Click Generate token.
Copy this token to clipboard.
GitConfig
The Global GitConfig file needs to edited in order to access repositories that are listed as private.
Scope
Location and Filename
System
~etc/gitconfig
Global
~home/<username>/.gitconfig or ~root/.gitconfig
Local
<git-repo>/.git/config
Worktree
<git-repo>/.git/config.worktree
In the .gitconfig file present in the ~home/<username>/ directory please add these lines:
Go Environment
Please check that your GoLang environment has the private module added as well.
You can run this command to add a private repository:
Once that is done please execute this command to check your environment:
The output should have listed the added URL as a private repository
Last updated