Git Repositories

What

The Stoplight Platform is built on top of Git. This means that all your projects are Git repositories and that our platform benefits from all the additonal functionality provided by Git. To access the Git funtionality, you will need to clone your Git repository by generating an Access Token.

You can also use Access Tokens to access the Stoplight API, authenticate Prism in a continuous integration enviornment, and access the underlying Git repositories for projects. You can make this part of your Git workflow, add it to scripts, or your CI/CD process

Who

If you have write access to a project, you will be able to:

  • Pull projects via Git
  • Commit to projects via Git
  • Push changes to projects via Git

If you have read access to a project, you will be able to:

  • Pull your project via Git

How to Clone Your Stoplight Git Repository

  1. Select the Settings tab on the platform homepage
  2. Select Access Tokens from the left

Access Tokens

  1. Create a token to access projects that your Stoplight account has proper permissions for (These permissions match the ones in the Stoplight UI)

You can name your token whatever you want. Once you have created the token, copy it, and only store it in a safe location. Once you close the window, you will not see it again

  1. On your machine, store your access token as an environmental variable (recommended)

For example, on Mac/Linux:

export STOPLIGHT_TOKEN="1234567890"
  1. You can then git clone the repo, replace {stoplight-username}, {username}, and {project-name} with the appropriate information:
git clone https://{stoplight-username}:$STOPLIGHT_TOKEN@git.stoplight.io/{username}/{project-name}.git

For example:

git clone https://taylor:$STOPLIGHT_TOKEN@git.stoplight.io/taylor/test-new.git

If the project is associated with an organization and not a personal project, replace username with organization-name

  1. Now you can make changes to your files, commit, and push to your master branch. You can see these changes in the Stoplight UI as well as the “History of Changes”

Remember: You will only see changes on the master branch in the UI at this time.


Related Articles