How to Authenticate GitHub with OAuth


Just released a new step: authenticate-with-github-oauth, so if you have two-factor authentication, private submodules, etc. then using a Personal Access Token would be the best bet.

To make this possible globally, this step writes GitHub OAuth configs to the ~/.netrc file, so every single network call pointing to or hosts will be accessed with the given Personal Access Token and the GitHub username.

#Add the step to your workflow

This step should be before any other git step in your workflow. Can go straight to the first place. :ok_hand:

An example bitrise.yml:

format_version: 1.3.1

    - authenticate-with-github-oauth:
        - username: myusername
        - access_token: myaccesstoken
    - activate-ssh-key:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone: {}

#Configuring the step

  • GitHub username: your GitHub username
  • Personal Access Token: your Personal Access Token

#Get a GitHub Personal Access Token

  1. Login to yout GitHub account
  2. In the upper-right corner of any page, click your profile photo, then click Settings.
  3. In the left sidebar, click Personal access tokens.
  4. Click Generate new token.
  5. Give your token a descriptive name.
  6. Select the scopes, or permissions, you’d like to grant this token.
  7. Click Generate token.

Happy Coding! :tada::rocket:

1 Like

@tamaspapik What if I want to auth both with e.g. GitHub and Bitbucket? :wink:

Also: do I need the Activate SSH Key step?

@viktorbenei Could you add this to the Web interface which creates new app workflow?

1 Like

You can use both easily.
Activate SSH Key step is not required, however you will need to use git urls starting with https://...