Overview
Enabling your AI agent to work on full existing code projects unlocks a new set of capabilities. This guide explains how to give your AI agent access to entire codebases, allowing it to make changes and run projects end-to-end like a human engineer.Using Code Mounts
While you can use normal shell exec commands to clone a public GitHub repository, Runloop’s Code Mounts provide a more powerful way to manage source code on your Devboxes. Code Mounts allow you to mount a repository into your Devbox under your user’s home directory.Creating a Devbox With a Public Code Mount
To add a CodeMount to your Devbox, specify the GitHub repo owner owner and name when you create it:If you want to create pull requests or make other changes to the remote repo you must configure your Git Auth as described below.
Connecting to Private GitHub Repositories
To enable your Devbox to interact with private GitHub repositories, you need to provide proper authentication credentials. Runloop offers several methods to achieve this.Using Code Mounts with GitHub Token
When you create a Devbox with a Code Mount, Runloop automatically sets up theGH_TOKEN environment variable and credential cache for you. This authenticates all command-line tools in your Devbox with your GitHub token. This allows your AI agent to use Github and open authenticated pull requests using the gh cli tool.
Manually Configuring Your Devbox for GitHub
Alternatively, you can configure your Devbox manually usingsetup_commands when you create your Devbox:
- Creates a new Devbox
- Sets the
GH_TOKENenvironment variable with your GitHub token - Configures Git to use the credential cache
- Stores your GitHub token in the Git credential cache for one hour
GH_TOKEN environment variable is only set while
the setup commands are running; it is not saved directly to the
Devbox. Using the credential cache with a timeout allows you to save
limited use credentials to the Devbox image.
Best Practices for Token Security
- Use tokens with the minimum required permissions for your tasks.
- Regularly rotate your GitHub tokens.
- Never commit or push files containing your tokens to version control.
- Use environment variables when possible to avoid exposing tokens in command-line arguments.
