Skip to content

Accessing GitHub

Christoph Held edited this page Sep 24, 2024 · 4 revisions

This guide provides two methods: using the GitHub CLI or using a fine-grained token. Github recommends using the CLI, as it is more secure and convenient. Note that classical personal access tokens are disabled for the Allianz GitHub organization. Additionally, there are alternative authentication options such as the Git Credential Manager, but these are not described in this guide.


Method 1: Using GitHub CLI (Recommended)

Prerequisites:

  • GitHub CLI (gh) installed on your system. Download.

Instructions:

  1. Authenticate GitHub CLI:

    • Authenticate gh with your GitHub account:
      gh auth login
    • Follow the prompts to authenticate using your GitHub credentials or a web browser.
  2. List and Clone Public Repositories:

    • List public repositories of the organization:
      gh repo list allianz
    • Clone a repository using gh:
      gh repo clone allianz/<repository>

Method 2: Manual Setup with Fine-Grained Token

Instructions:

  1. Create a Fine-Grained Personal Access Token:

    • Go to your GitHub account settings.
    • Navigate to Settings > Developer settings > Personal access tokens > Fine-grained tokens.
    • Click on Generate new token.
    • Provide a name and set an expiration date for the token.
    • Under Resource owner, select Allianz.
    • Select Only select repositories and choose the repositories you want to access.
    • Grant only the following repository permissions:
      • Contents: Read and write
      • Metadata: Read
    • Click Generate token.
    • Copy and save the token securely.
  2. Clone a Repository:

    • Clone the desired repository using the token:
      git clone https://github.com/allianz/<repository>.git
    • When prompted, specify the token as the password.