Skip to main content

Manage your credentials

Harbor requires both the Project Key and the User Key to identify the project and the user. Follow the below steps to configure your credentials with Harbor.

Managing Project key​

info

You need to create a project first before you can copy the key. Learn how to do that here.

All project keys of each project are found in the homepage as the third card of a project. Click on the copy button to copy the key!

project_key

As admin​

As an admin of a project, you can change your Project Key. To do this, select the Project Key in the projects' tabs on the left side of the page. Then, in the Project Key card, click the Regenerate button to change the Project Key to a new one.

change_key

As team member​

If you're a member of a project, you can only view and copy the Project Key.

api_key

Getting User Key​

Head on over to your homepage and click on the User Key button on the top right corner. When the pop-up appears, click the Regenerate button to get a new Project Key. Or, click the copy icon button to copy the key.

empty_testnets

Set up​

Run the command:

harbor configure keys

This will prompt you to add both the user_key and the project_key. Paste both keys, prompt by prompt:

Updating existing credentials file...
user_key: n5kf6gdWZzciDsGiSHdAfz
project_key: kEuTW4o3R4AV1nb298gumB

It should say:

successfully configured harbor with credentials
now you can run harbor build on a configuration file!

Using flags​

We can use different flags to surpass these prompts. The flags user-key and project-key can be used to configure our credentials right away. With flags, the command to configure your keys looks like this:

harbor configure keys --user-key n5kf6gdWZzciDsGiSHdAfz --project-key kEuTW4o3R4AV1nb298gumB

Which will give us:

Updating existing credentials file...
successfully configured harbor with credentials
now you can run harbor build on a configuration file!

As you can see, no prompts are asked and therefore it sets up the credentials right away.

Common errors​

No User Key found​

If you try to run a harbor command when:

  • A User Key doesn't exist
  • Or, if you regenerate a user_key and you don't update the user_key from the CLI

Then you should see the following error message:

no user with that User Key found

Deleted project​

If a project is deleted and your configured project key is of the deleted project, then running any harbor command should generate the following:

the project is no longer active

No projects found​

If you try to run a harbor command when:

  • The project's key is regenerated and you didn't update the latest project key
  • Or, the project's project key is incorrect

Then you should see the following error message:

no projects with that Project Key found

Unprivileged user​

If you try to run a harbor command when:

  • You are not in the project but you somehow have the project key
  • Or, you have not accepted the project's invite request

Then you should see the following error message:

user is not privileged to use this project