> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ghostable.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Import & Export .env Files

> Bring local env files into Ghostable or export encrypted environment state back to disk from the desktop app.

<Card title="Read the shared environment model" icon="circle-info" href="/fundamentals/v2/core-objects/environments">
  Desktop import and export workflows operate on the same environment records used by CLI and
  automation.
</Card>

## Import a Local File

From the Variables view, choose **Import .env File…** to parse a local environment file and push its
entries into the current Ghostable environment.

Desktop preserves useful details from the imported file, including disabled variables, then writes
the resulting state back through the encrypted environment workflow.

{/* ghostable:screenshot-output desktop-import-env-variables-main:start */}

<img className="block dark:hidden w-full" src="https://mintcdn.com/ghostable/BOl2AUG1DFr1k8ob/images/generated/screenshots/ghostable-desktop/environment-variables-main-light.png?fit=max&auto=format&n=BOl2AUG1DFr1k8ob&q=85&s=91579fb29851f16ffdaf0bc42e67479f" alt="Ghostable desktop variables view showing the main variable list and the import and export controls in the toolbar." width="2440" height="1344" data-path="images/generated/screenshots/ghostable-desktop/environment-variables-main-light.png" />

<img className="hidden dark:block w-full" src="https://mintcdn.com/ghostable/BOl2AUG1DFr1k8ob/images/generated/screenshots/ghostable-desktop/environment-variables-main-dark.png?fit=max&auto=format&n=BOl2AUG1DFr1k8ob&q=85&s=2f2d966927aa4ff0216e697fc6b72e07" alt="Ghostable desktop variables view showing the main variable list and the import and export controls in the toolbar." width="2440" height="1344" data-path="images/generated/screenshots/ghostable-desktop/environment-variables-main-dark.png" />

## Export Back to Disk

From the same Variables view, use the export button to write the current environment into a local
`.env.<environment>` file.

Desktop requires a linked project folder before export is enabled, because it uses that folder as
the default destination.

{/* ghostable:screenshot-output desktop-export-env-success:start */}

<img className="block dark:hidden w-full" src="https://mintcdn.com/ghostable/BOl2AUG1DFr1k8ob/images/generated/screenshots/ghostable-desktop/environment-export-success-light.png?fit=max&auto=format&n=BOl2AUG1DFr1k8ob&q=85&s=f97cf21dced1991a14e8f8da90fd423e" alt="Ghostable desktop export confirmation showing the .env.production destination path inside the linked project folder." width="2440" height="1344" data-path="images/generated/screenshots/ghostable-desktop/environment-export-success-light.png" />

<img className="hidden dark:block w-full" src="https://mintcdn.com/ghostable/BOl2AUG1DFr1k8ob/images/generated/screenshots/ghostable-desktop/environment-export-success-dark.png?fit=max&auto=format&n=BOl2AUG1DFr1k8ob&q=85&s=5e05812678b1c0fed75ba01c0ac25330" alt="Ghostable desktop export confirmation showing the .env.production destination path inside the linked project folder." width="2440" height="1344" data-path="images/generated/screenshots/ghostable-desktop/environment-export-success-dark.png" />

## Export Safety

When Desktop exports to an existing file path, it performs a replacement workflow and creates a
backup before writing the new file.

<Warning>
  Export produces plaintext local files. Keep the destination inside the trusted project folder
  and handle the output according to your team's secret-management policy.
</Warning>

## Continue

<CardGroup>
  <Card title="Link a folder" icon="folder-open" href="/desktop/v1/local-integration/link-a-folder">
    Export requires a linked local project folder.
  </Card>

  <Card title="Use CLI pull and push" icon="terminal" href="/cli/v2/workflows/environments">
    Prefer the terminal if your local file workflow already lives in scripts.
  </Card>
</CardGroup>
