If you're developing a project that requires local changes before it can be deployed (like a regular application), running just now is the right way to move your code into the cloud.
However, if you'd like to provide a pre-built application or tool which only needs to be configured slightly to fit the needs of the end user, we have another great feature for you:
When running this command for a certain Git repository of your choice (make sure to replace
<repository>), the repository will be looked up on GitHub, GitLab, and BitBucket. When found, Now will automatically clone it, set any custom properties you've defined and deploy it.
From there on, it will work just like any other deployment: You'll get a unique URL once the files have started uploading, your deployment will be initialized and then started up as usual.
Thanks to the process I've explained earlier, configuring the deployment of a Git repository is just as easy as doing the same for one that's not being handled automatically by Now in the hidden.
If you want, you can either use
now.json or the
now property inside
package.json within your repository for customizing the deployments. But please note that these settings can't be interfered with by the user. They're fixed.
For the cases in which the user needs to specify his own settings, environment variables can be used.
This will deploy the now-examples/slackin repository and set the environment variables
SLACK_API_TOKEN (containing the API token) and
SLACK_SUBDOMAIN (holding the subdomain of your team).
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:
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:
And it works just as easy for commits. Just append the SHA:
By default, Now will select the master branch. However, as you can see, it only requires a single statement to change this!
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):
This also means that you can easily point to commits:
...or even branches:
Behind the curtains, the command line interface (now) will firstly clone the repository to your local device (in a hidden directory).
This ensures that even private repositories (or such that require a special form of authentication) will get cloned automatically without you having to specify any credentials. In addition, it's much more secure than cloning the code on the platform, because our system doesn't need to move any of your sensitive authentication data to our servers.
Afterward, the regular mechanism for handling the upload of your files will be applied to the local directory that contains a clone of the repository you've defined before.