# 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.

1. Log into your **account**.
2. In the upper-right corner of any page, click your profile photo, then click **Settings**.
3. In the left sidebar, click **Developer settings**.
4. In the left sidebar, click **Personal access tokens**.
5. Click **Generate new token**.
6. Give your token a descriptive **name**.
7. Select an **expiration** date and also access permission for the token, such as **'repo'**
8. Click **Generate token**.
9. 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:

```
[url "https://<USERNAME>:<PERSONAL ACCESS TOKEN>@github.com/"]
        insteadOf = "https://github.com/"
[http]
        sslVerify = false
```

## 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:

```
go env -w GOPRIVATE=github.com/reapchain
```

Once that is done please execute this command to check your environment:

```
go env
```

The output should have listed the added URL as a private repository

```
GOPRIVATE="github.com/reapchain"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://reapchain.gitbook.io/mainnet/developer-guides/private-repository-access.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
