When you want to reference a private repository

How to build a repository using Diarkis-cli when it involves a private repository

Overview

When building with Diarkis-cli, if the project references a private repository, an authentication error occurs on the build server. This document explains how to circumvent this issue.

Problem

If you attempt to build as is, the build server of Diarkis-cli will encounter an authentication error with the code in your private repository.

Solution

You can avoid this issue by following these steps:

  1. Copy the private repository code locally

    Copy the directory of the private repository into the same repository.

  2. Modify go.mod

    Change it to reference the local repository as shown below:

    require (
    	github.com/Org/privateModule v0.0.0-00010101000000-000000000000
    )
    
    replace github.com/Org/privateModule => ./private-module // change Org and privateModule

    (Replace 'Org' and 'privateModule' with the actual names as needed)

  3. Execute the build

    Proceed with the build as usual, and it should succeed.

TIPS

By specifying unnecessary files from the local private repository directory in .buildignore, you can reduce the amount to be uploaded.

Last updated

Was this helpful?