Advanced Git

This documentation is for Dash Enterprise.
Dash Enterprise is the fastest way to write & deploy Dash apps and
Jupyter notebooks.
10% of the Fortune 500 uses Dash Enterprise to productionize AI and
data science apps. Find out if your company is using Dash Enterprise.

Running Git commands is a supported method of deploying apps to Dash Enterprise; however, we
recommend using the the Dash Enterprise CLI, which is based on Git, but
reduces the deployment process to a single command.

This guide is provided as a reference for app developers who opt to deploy using Git commands instead of the Dash Enterprise CLI.

Deploying Your App with Git Commands

Prerequisites

If your workstation uses Windows, we recommend downloading Git from the official source, where it comes bundled
with a Linux-like terminal called Git Bash. The Dash Enterprise documentation assumes that you use Git Bash to run Git commands on Windows.

Creating a Git Repository

With your app’s files prepared, you now need to turn the folder they are in into a Git repository. This creates a hidden .git directory in your folder that contains the required Git metadata.

If you cloned a folder from Dash Enterprise or another source like GitHub, this metadata already exists, so you can skip to Configuring Your Git Remote.

To create a Git repository:

  1. In your terminal, go to your app folder:
    shell $ cd <folder-name>
    where <folder-name> is the name of the folder.

  2. Create the Git repository:
    shell $ git init

Your terminal displays a message like Initialized empty Git repository. You can run git status to see that you are on the default Git branch (which is usually main, but can sometimes be master).
Git branches are a version control feature that allow you to work off different versions of your app. Learn more about Git branches.

Language note: The folder on your workstation is now more accurately described as a local Git repository (or repo for short). We’ll keep using folder for the remainder of the steps on this page, but you
might see local Git repository elsewhere in the Dash Enterprise documentation.

Configuring Your Git Remote

Next, you’ll configure a Git remote for Dash Enterprise. A Git remote creates a connection to the Dash Enterprise server, which you’ll use when pulling (downloading)
or pushing (sending) app changes. The name we recommend for your Git remote is plotly (Plotly is the name of our team—the developers behind Dash Enterprise—and you might also
recognize it from the plotly.py graphing library).

To add a Git remote named plotly:

  1. In your terminal, go to your app folder:
    shell $ cd <folder-name>
    where <folder-name> is the name of the folder.

  2. Add the Git remote:
    shell $ git remote add plotly <remote-url>
    where <remote-url> is the Git remote URL available in the Dash Enterprise app Overview. To access it, select More comfortable with Git commands?.

<img>

The URL changes depending on whether you’re deploying over HTTPS or SSH, so be sure to select the right
protocol before you copy the URL.

Note: If you plan to use the same files for more than one app, you’ll need to repeat step 2 for each additional app and make sure to use different Git remote names.
Using the same files with multiple apps is something you might do if you want to have one app to preview changes (often called a staging app) and a different app for
your end users (often called the production app). Learn more in Creating a Staging App.

You’re ready to deploy your app to Dash Enterprise.

Deploying Your App

To deploy your app:

  1. In your terminal, go to your app folder:
    shell $ cd &lt;folder-name&gt;
    where &lt;folder-name&gt; is the name of the folder.

  2. Check which files you have modified. This is optional, but it’s good practice to confirm that you see the files you expect to see:
    shell $ git status

For example, if you used the sample Hello World files provided above, the output would be similar to:
```shell
On branch main

No commits yet

Untracked files:
(use “git add <file>…” to include in what will be committed)
.gitignore
Procfile
app.py
requirements.txt

nothing added to commit but untracked files present (use “git add” to track)
```
If Git lists files that you didn’t intend to modify, review your local changes.

  1. Add all your changes:
    shell $ git add .

or only specific files:
shell $ git add &lt;my-file&gt;

  1. Commit your changes:
    shell $ git commit -m "&lt;commit-message&gt;"
    where &lt;commit-message&gt; is a description of your changes. You can use something like “First commit” if this is your first commit.

  2. Deploy your app:
    shell $ git push plotly main

Or, if your local branch is something different, like master, use:
shell $ git push plotly master:main

If you receive an error, refer to Common Errors for help troubleshooting.

When you need to update your Dash Enterprise app, make the changes you want to its files on your workstation, and then repeat steps 1-5.

Additional Resources

For more information regarding version control and Git commands, see the official Git
documentation
.