s used for each run.

Creating a GitHub RepositoryWhile ZenML supports many different flavors of git repositories, this guide will focus on GitHub. To create a repository on GitHub:

Sign in to GitHub.

Click the "+" icon and select "New repository."

Name your repository, set its visibility, and add a README or .gitignore if needed.

Click "Create repository."

We can now push our local code (from the previous chapters) to GitHub with these commands:

# Initialize a Git repository

git init

# Add files to the repository

git add .

# Commit the files

git commit -m "Initial commit"

# Add the GitHub remote

git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git

# Push to GitHub

git push -u origin master

Replace YOUR_USERNAME and YOUR_REPOSITORY_NAME with your GitHub information.

Linking to ZenML

To connect your GitHub repository to ZenML, you'll need a GitHub Personal Access Token (PAT).

Go to your GitHub account settings and click on Developer settings.

Select "Personal access tokens" and click on "Generate new token".

Give your token a name and a description.

We recommend selecting the specific repository and then giving contents read-only access.

Click on "Generate token" and copy the token to a safe place.

Now, we can install the GitHub integration and register your repository:

zenml integration install github

zenml code-repository register <REPO_NAME> --type=github \

--url=https://github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git \

--owner=YOUR_USERNAME --repository=YOUR_REPOSITORY_NAME \

--token=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN

Fill in <REPO_NAME>, YOUR_USERNAME, YOUR_REPOSITORY_NAME, and YOUR_GITHUB_PERSONAL_ACCESS_TOKEN with your details.

Your code is now connected to your ZenML server. ZenML will automatically detect if your source files are being tracked by GitHub and store the commit hash for each subsequent pipeline run.

You can try this out by running our training pipeline again:

# This will build the Docker image the first time