# import

The `onepub import` command allows you to login when a Web browser and/or user interaction isn't viable such as in a [CI/CD](/guides/ci-cd.md), [SSH](/guides/ssh.md) or [Docker](/guides/docker.md) environment.

The `import` command imports a OnePub authentication Token which you obtain by running the [`onepub export`](/guides/cli-integration/export.md) command.

The `export` command can either display the token to the console or save it to a file.

### import

If run the import command with no arguments it expects to find an environment variable called `ONEPUB_TOKEN`.&#x20;

This technique is mostly used in a CI/CD environment which provides a **secret store** (e.g. github actions).

If you need to import into a shell that you have logged in to, then use the `onepub import --ask` option.

The value of the `ONEPUB_TOKEN` environment variable is the authentication token reported by the onepub export command.

Run the onepub export command on your local machine after login into onepub

```bash
> onepub login
...
> onepub export
OnePub version: 1.4.1 

Exporting OnePub token for OnePub.

Add the following environment variable to your CI/CD secrets.

ONEPUB_TOKEN=8a3e9999-b79b-46ad-b9dc-968ff99993c1
```

Create the ONEPUB\_TOKEN environment variable (this is usually done using your CI/CD secret store).

```
export ONEPUB_TOKEN=8a3e9999-b79b-46ad-b9dc-968ff99993c1
onepub import
```

### import --ask

If you used the `export` command to display the token to the console then use the `import --ask` option and type the token into the console:

```bash
onepub import --ask
ONEPUB_TOKEN: 
```

### import --file

If you exported the token in a file then you use the `onepub import --file` command to import the token.

If you didn't specify a filename when exporting the OnePub Token then the token will have been saved into \`./onepub.token.yaml\`. &#x20;

If you run the `import --file` command without providing a file name then the `import` command will assume the file `onepub.token.yaml` contains the token and lives in the current directory.

### import --file \<path to file>

If you exported the OnePub Token to an alternatively named file or the token file is in a different directory then you can provide the path to the OnePub Token file.

```bash
onepub import --file <path to token file>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onepub.dev/guides/cli-integration/import.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
