gitingest icon indicating copy to clipboard operation
gitingest copied to clipboard

feat: support for private repositories

Open yucchan opened this issue 7 months ago • 3 comments

is it possible to add support for private repos (by way of token or some other secure auth measure)?

yucchan avatar May 20 '25 12:05 yucchan

Hi @yucchan and others — great news!

Private-repo support just landed on main via PR #282 (merged 2025-06-15). You can already ingest a private repository from the CLI or Python API:

# PAT needs at least the “repo” (or narrower “repo:read”) scope
export GITHUB_TOKEN=github_pat_********

# any of these work
gitingest https://github.com/my-user/my-private-repo                    # uses env-var
gitingest https://github.com/my-user/my-private-repo --token <PAT>
gitingest -t <PAT> https://github.com/my-user/my-private-repo
from gitingest import ingest
ingest("https://github.com/my-user/my-private-repo", token="<PAT>")

How it works

  • The token (github_pat_*, ghp_*, etc.) is injected into git via http.https://github.com/.extraheader, so partial clones, sparse-checkout and commit pins behave exactly as they do for public repos.
  • Public-repo workflows stay unchanged — if there’s no token, no auth header is sent.

What’s next

Timeline Scope
Later this week PyPI release of the core library & CLI with PAT support t.
Afterwards A separate follow-up PR will surface a PAT field in the gitingest.com web UI.

In the meantime you can grab the development build:

pip install --pre --upgrade git+https://github.com/cyclotruc/gitingest.git

To generate a GitHub Personal Access Token (PAT), go to (ProfileSettingsDeveloper SettingsPersonal Access TokensFine-grained Tokens), or click here.

Let me know if you run into any issues — happy to help! 🎉

filipchristiansen avatar Jun 16 '25 16:06 filipchristiansen

Great! Is there some way that I am missing to utilize this if I am running gitingest in a docker container?

I tried to pass in an .env file to the docker run: docker run -d --name gitingest -p 8000:8000 --env-file .env gitingest

, but I am getting the error

Image

From what I can tell, it hasn't attempted to utilize the token that I passed in, as it is showing in github as never used

RyandenOtter avatar Jun 20 '25 16:06 RyandenOtter

Great! Is there some way that I am missing to utilize this if I am running gitingest in a docker container?

I tried to pass in an .env file to the docker run: docker run -d --name gitingest -p 8000:8000 --env-file .env gitingest

, but I am getting the error

Image

From what I can tell, it hasn't attempted to utilize the token that I passed in, as it is showing in github as never used

Hi, the private repo support in the web UI has not yet been merged with main, nor released to PyPI. This pending PR https://github.com/cyclotruc/gitingest/pull/286 will add this. I have asked @cyclotruc to review the PR. Until then, you can try checkout the feature branch https://github.com/cyclotruc/gitingest/tree/feat/private-repo-support-ui.

filipchristiansen avatar Jun 21 '25 09:06 filipchristiansen

@yucchan @RyandenOtter It should be working now.

Hi @yucchan and @RyandenOtter!

Private repo support in the web UI has been merged with main and will soon be released to PyPI. The hosted version on gitingest.com has been updated.

filipchristiansen avatar Jun 22 '25 19:06 filipchristiansen

When trying that feature on the web UI, I'm getting

Error: invalid literal for int() with base 10: "000HTTP/2 404 \r\ndate: Thu, 03 Jul 2025 14:02:06 GMT\r\ncontent-type: application/json; charset=utf-8\r\nx-github-media-type: github.v3; format=json\r\nx-github-api-version-selected: 2022-11-28\r\na

I created the token using the suggested way in the web UI.

Caselles avatar Jul 03 '25 14:07 Caselles