DEV Community

Super Kai (Kazuya Ito)
Super Kai (Kazuya Ito)

Posted on • Edited on

Clone a private repository with FGPAT from Github

Buy Me a Coffee

*Memos:

  • My post explains how to clone a private repository with PAT(Personal Access Token) from Github.
  • My post explains useful IPython magic commands.

With FGPAT(Fine-Grained Personal Access Token), you can clone a private repository from your account and you can also clone a private repository from your organization if you're its owner or member:
*Memos:

  • You need to generate a FGPAT and add it to the command below. *Organization doesn't have FGPAT or PAT generator.
  • A FGPAT can select permissions more precisely(finely) than PAT.
  • fgpat is FGPAT.
  • pat is PAT.
  • usr is username.
  • org is organization.
  • repo is repository.
git clone https://<fgpat or pat>@github.com/<usr or org>/<repo>.git
Enter fullscreen mode Exit fullscreen mode

<How to generate a FGPAT from your account>

  1. Go to Settings:
    Image description

  2. Go to Developer settings:
    Image description

  3. Press Generate new token from Personal access tokens/Fine-grained tokens:
    Image description

  4. Fill Token name, then select All repositories in Repository access. *You can select Only select repositories to only select the repositories you want but don't select Public Repositories (read-only) otherwise you cannot clone a private repository:
    Image description

  5. Set Access: Read and write for Contents to clone a private repository and to do some basic operations such as add, commit, push etc.
    Image description

  6. Press Generate token:
    Image description

  7. Finally, a FGPAT is generated:
    Image description

This is the command with the FGPAT generated above:

git clone https://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@github.com/<usr or org>/<repo>.git
Enter fullscreen mode Exit fullscreen mode

Billboard image

Use Playwright to test. Use Playwright to monitor.

Join Vercel, CrowdStrike, and thousands of other teams that run end-to-end monitors on Checkly's programmable monitoring platform.

Get started now!

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay