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

Top comments (0)