Skip to content

Latest commit

 

History

History
32 lines (31 loc) · 1.41 KB

README-privategithubrepos.md

File metadata and controls

32 lines (31 loc) · 1.41 KB

If you need to connect to a private git repo, in order to import it with CodeReady Workspaces, these instructions should help.

First, you'll need to create a credential secret.

  1. Set variables for your github username and a personal access token with full repo permissions.
    GITHUB_USERNAME=andykrohg
    GITHUB_TOKEN=ghp_000000000000000000000
  2. Switch to (or create) the namespace where your workspaces will be provisioned, which by default is ${username}-codeready. For example:
    oc project user1-codeready
  3. Create a secret to hold your git credentials. The annotations will inform the CodeReady Server that it needs to mount the secret into your workspace once it's created.
    oc apply -f - << EOF
    apiVersion: v1
    kind: Secret
    metadata:
        name: git-credentials-secret
        labels:
            app.kubernetes.io/part-of: che.eclipse.org
            app.kubernetes.io/component: workspace-secret
        annotations:
            che.eclipse.org/automount-workspace-secret: 'true'
            che.eclipse.org/mount-path: /home/theia/.git-credentials
            che.eclipse.org/mount-as: file
            che.eclipse.org/git-credential: 'true'
    stringData:
        credentials: https://$GITHUB_USERNAME:$GITHUB_TOKEN@github.com
    EOF
  4. Create a new workspace using the devfile.yaml in your repository.