This post contains content about Now 1.0 – Learn about the latest version, Now 2.0.
Now 2.0 - Upgrade Available
(almost 3 years ago)

Deploying Git Repositories

Leo Lamprecht (@notquiteleo)

Until today, the common workflow for deploying a project located on GitHub was cloning it to your device, adjusting it and then running now to shoot it up into the cloud.

With this update, it's getting much easier.

Assuming that you'd like to spin up an instance of rauchg's slackin project (a simple invitation page for Slack teams), this is what the command will look like:

▲ now rauchg/slackin

Generally speaking, the above is the only thing you need to run in order to deploy a GitHub repository directly to Now.

In this case, however, you also need to tell slackin the name of the Slack team it should send invitations for and the API key. Thankfully, you can use all of the existing options of now in combination with this new feature!

Therefore, you can easily specify these details as environment variables:

▲ now -e SLACK_API_TOKEN="23uhc87" -e SLACK_SUBDOMAIN="socketio" rauchg/slackin

That's it!

Once Now fetches the repository, you'll see just what you're used to: A link to the deployment, the repository will be deployed and the logs will be printed out. Once the repo has finished uploading, you'll see the invitation page:

Selecting a Git Reference

Since there might be cases in which you'd like to choose a certain branch or commit containing a special change you'd like to share with other people (or see how it works in production mode), we've made it very easy to select a git reference of your choice.

Simply append a # followed by the name of the branch or the commit. Assuming that you'd like to deploy the branch "v2", this is how the command will look like:

▲ now rauchg/slackin#v2

And it works just as easy for commits. Just append the SHA:

▲ now rauchg/slackin#e0f09a5

By default, Now will select the master branch. However, as you can see, it only requires a single statement if you want to change this behavior!

Using URLs

All of the things mentioned above can also be achieved by simply telling Now the URL of the repository which you'd like to deploy (also supports GitLab and BitBucket):

▲ now

This also means that you can easily point to commits:

▲ now

...or even branches:

▲ now

How to Get It

If you've installed Now's command line interface using Now Desktop, the only thing you need to do is make sure that the application is running. Assuming that's the case, the binary will automatically be updated for you in the next few minutes!

However, if that's not the case, we highly recommend you to download it and use it to install the CLI. Afterwards, you're covered!

If you're on a platform that's not yet supported by Now Desktop, simply update/install the command line utility like this: npm install -g now@latest


Have fun with this new feature!