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 <username> and <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.
When deploying rauchg's slackin project, for example, you somehow need to define the API token and subdomain of your Slack team. And that's exactly where environment variables come in really nicely:
now -e SLACK_API_TOKEN="23uhc87" -e SLACK_SUBDOMAIN="socketio" now-examples/slackin
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!
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 sensible authentication data to our servers.
Afterwards, 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.