Skip to content

Commit 1dd7290

Browse files
fix GITHUB_PAT_PATTERN and add instructions to README
1 parent e8156a9 commit 1dd7290

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ You can also replace `hub` with `ingest` in any GitHub URL to access the corresp
2929
## 📚 Requirements
3030

3131
- Python 3.7+
32+
- For private repositories: A GitHub Personal Access Token (PAT). You can generate one at [https://github.com/settings/personal-access-tokens](https://github.com/settings/personal-access-tokens) (Profile → Settings → Developer Settings → Personal Access Tokens → Fine-grained Tokens)
3233

3334
### 📦 Installation
3435

@@ -83,6 +84,10 @@ gitingest /path/to/directory
8384
# From URL
8485
gitingest https://github.com/cyclotruc/gitingest
8586

87+
# For private repositories, use the --token option
88+
# Get your token from https://github.com/settings/personal-access-tokens
89+
gitingest https://github.com/username/private-repo --token github_pat_...
90+
8691
# See more options
8792
gitingest --help
8893
```

src/gitingest/utils/git_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
from typing import List, Optional, Tuple
77

8-
GITHUB_PAT_PATTERN = r"^(?:github_pat_|gph_)[A-Za-z0-9_]{40,}$"
8+
GITHUB_PAT_PATTERN = r"^(?:github_pat_|gph_)[A-Za-z0-9_]{36,}$"
99

1010

1111
async def run_command(*args: str) -> Tuple[bytes, bytes]:
@@ -262,5 +262,5 @@ def validate_github_token(token: str) -> None:
262262
if not re.match(GITHUB_PAT_PATTERN, token):
263263
raise ValueError(
264264
"Invalid GitHub token format. Token should start with 'github_pat_' or 'gph_' "
265-
"followed by at least 40 characters of letters, numbers, and underscores."
265+
"followed by at least 36 characters of letters, numbers, and underscores."
266266
)

0 commit comments

Comments
 (0)