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

# Get your code

> Download your Newly v2 project's code to your computer with the newly CLI.

You can download your app's code from Newly v2, at app.newly.app and in Newly for Mac, to your own computer. There's no Download ZIP or export button in the app. Instead, use the newly command-line tool (CLI).

## Download your project with the CLI

You'll need a computer with Node.js 20 or later and a terminal.

<Steps>
  <Step title="Install the CLI">
    ```bash theme={null}
    npm i -g @newly/cli
    ```
  </Step>

  <Step title="Sign in">
    Sign in with your Newly account:

    ```bash theme={null}
    newly login --email
    ```

    Or use `newly login --google` or `newly login --github`. With `--email`, Newly sends you a code to type into the terminal.
  </Step>

  <Step title="Find your project ID">
    Open the project in the web app. The ID is the last part of the address: app.newly.app/projects/`<project-id>`.
  </Step>

  <Step title="Pull the code">
    Create an empty folder, open it in your terminal, and run:

    ```bash theme={null}
    newly pull <project-id>
    ```

    The CLI downloads the project's app and backend code into that folder.
  </Step>
</Steps>

### Which branch you get

By default, `newly pull` downloads the `dev` branch, which is where your chats work. If the project has no `dev` branch, it downloads `main`. See [Where your code lives](/code/where-your-code-lives) for how the two branches differ.

### Options

| Option            | What it does                                                                                                                                                                          |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--branch <name>` | Download a specific branch, for example `--branch main`.                                                                                                                              |
| `--force`         | Download into a folder that isn't empty. This replaces local changes, and removes top-level files and folders that aren't in the project. It keeps `.git`, `node_modules` and `.env`. |

Very large projects may be too big to download this way. If `newly pull` refuses a project for its size, [contact support](/help/getting-help).

### Other useful commands

* `newly whoami` shows which account you're signed in with.
* `newly logout` signs you out.

## What you can and can't do with the code

* **You can** open the code in your own editor, read it and keep a backup.
* **You can't** send app code from your computer back into a Newly project. To change the app in Newly, ask the agent in a chat.

The CLI can also deploy your Newly Backend and manage its development secrets. See [Production and secrets](/backend/production-and-secrets).

<Tip>
  On Mac: if you want to keep working in your own editor alongside the agent, open a folder on your Mac with **Open Existing Project**. The agent then works directly in that folder. The folder's path can't contain spaces. See [Local chats on your Mac](/mac/local-chats).
</Tip>

## GitHub

Newly v2 projects can't connect to GitHub, and there's no automatic sync to a GitHub repository.

To put your code on GitHub, download it with `newly pull` and push it to a repository yourself. Remember that later changes made in Newly won't reach GitHub unless you pull and push again.

### The "Github to Mobile App" starter

The **Github to Mobile App** starter on the Home screen doesn't import a repository. To base a new app on an existing website's look, paste the public link to that website into the prompt box. The agent copies its style into a mobile app.

## Related pages

<CardGroup cols={2}>
  <Card title="Where your code lives" icon="code-branch" href="/code/where-your-code-lives">
    Saved versions, branches and Promote to main.
  </Card>

  <Card title="Production and secrets" icon="key" href="/backend/production-and-secrets">
    Deploy your backend and set secrets with the CLI.
  </Card>
</CardGroup>
