Skip to main content

Import Profiles

Import profiles from a JSON file into gpx. Useful when moving to a new machine or restoring from a backup.

Usage

gpx import <filepath>

Options

OptionDescription
--mergeMerge with existing profiles instead of overwriting them
--jsonReturn structured JSON output

Examples

Basic import

By default, importing will overwrite any existing profiles with the same name.

gpx import profiles.json

Import from a specific path

gpx import ~/backups/my-profiles.json

Import and view result as JSON

gpx import profiles.json --json

What a valid import file looks like

A valid import file matches the format produced by gpx export:

{
"profiles": [
{
"name": "work",
"display_name": "Ada Lovelace",
"email": "ada@company.com",
"auth_method": "ssh",
"ssh_key": "~/.ssh/id_ed25519_gpx_work",
"github_username": "ada-lovelace"
},
{
"name": "freelance",
"display_name": "Ada Freelance",
"email": "ada@clientco.com",
"auth_method": "pat",
"github_username": "ada-freelance"
}
],
"exported_at": "2024-03-14T15:30:00.000Z"
}
NOTE

SSH key paths are imported as-is. Make sure the key files exist at those paths on the new machine, or run
gpx edit <name> --ssh-key <new_path> to update them after import.

Typical workflow - moving to a new machine

On the old machine:

gpx export -o profiles.json

On the new machine:

gpx import profiles.json
gpx ls # verify profiles were imported
WARNING

PAT tokens are not included in exports for security reasons. After importing PAT profiles, you must re-set the token by running gpx pat set <profile_name>.

  • gpx export - Export your profiles to a JSON file.