===================================================
Configuring user access to external version control
===================================================

If your organization is using an external version control repository, Workbench requires you to provide your authentication credentials to access the repository prior to creating your first project. 

.. tip:: 

    Anaconda recommends that you create a personal access token with no expiration date to retain permanent access to your files from within Workbench.

Your auth token must have the following permissions:

.. tab-set:: 

    .. tab-item:: GitHub

        `repo:status, repo_deployment, public_repo, repo:invite, and delete_repo <https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps/>`_
    
    .. tab-item:: GitLab 

        Select the ``api`` access checkbox when creating your access token. 

    .. tab-item:: Bitbucket 

        Bitbucket requires you to provide an `App password that has Admin level permissions for Projects and Repositories <https://support.atlassian.com/bitbucket-cloud/docs/app-password-permissions/#Projects>`_.

Adding an access token
======================

#. Open the |circle-user| **My account** dropdown menu, then select *Settings*.
#. Under **External Version Control Credentials**, click |plus| **Add**.
#. Enter the Username and Personal Access Token you generated to access the repository in the relevant fields. 
#. Click **Add** to update the platform with your credentials.

Now that you've configured access, you'll be able access the repository within your sessions and deployments without having to leave the platform. Workbench creates a repository for each :doc:`project that you create <projects/index>`. 

Editing an access token
=======================

#. Open the |circle-user| **My account** dropdown menu, then select *Settings*.
#. Open the |ellipsis-vertical| actions dropdown menu for your access token and select *Edit*.
#. Update your repository Username and/or Personal Access Token value, then click **Save**.

Deleting an access token
========================

#. Open the |circle-user| **My account** dropdown menu, then select *Settings*.
#. Open the |ellipsis-vertical| actions dropdown menu for your access token and select *Delete*.
#. Click **Delete**. 

.. |circle-user| raw:: html
   
   <svg class="inline" height="1.2em" width="1.2em"xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 496c-54 0-103.9-17.9-144-48v0c0-61.9 50.1-112 112-112h64c61.9 0 112 50.1 112 112v0c5.3-4 10.4-8.2 15.4-12.6C409.1 370.6 354.5 320 288 320H224c-66.5 0-121.1 50.6-127.4 115.4C47.2 391.5 16 327.4 16 256C16 123.5 123.5 16 256 16s240 107.5 240 240s-107.5 240-240 240zm0 16A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm80-304a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zm-80-64a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"/></svg>

.. |ellipsis-vertical| raw:: html

   <svg class="inline" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 512"><path d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/></svg>

.. |plus| raw:: html

    <i class="fa-light fa-plus"></i>