vercel redeploy
Learn how to redeploy your project using the vercel redeploy CLI command.The vercel redeploy
command is used to rebuild and redeploy an existing deployment.
vercel redeploy [deployment-id or url]
When redeploying, stdout
is always the Deployment URL.
vercel redeploy https://example-app-6vd6bhoqt.vercel.app > deployment-url.txt
If you need to check for errors when the command is executed such as in a CI/CD workflow,
use stderr
. If the exit code is anything other than 0
, an error has occurred. The
following example demonstrates a script that checks if the exit code is not equal to 0:
# save stdout and stderr to files
vercel redeploy https://example-app-6vd6bhoqt.vercel.app >deployment-url.txt 2>error.txt
# check the exit code
code=$?
if [ $code -eq 0 ]; then
# Now you can use the deployment url from stdout for the next step of your workflow
deploymentUrl=`cat deployment-url.txt`
echo $deploymentUrl
else
# Handle the error
errorMessage=`cat error.txt`
echo "There was an error: $errorMessage"
fi
These are options that only apply to the vercel redeploy
command.
The --no-wait
option does not wait for a deployment to finish before exiting from the redeploy
command.
vercel redeploy https://example-app-6vd6bhoqt.vercel.app --no-wait
Use the --target
option to define the environment you want to redeploy to. This could be production, preview, or a custom environment. For more information, see Using an environment through the Vercel CLI.
vercel redeploy https://example-app-6vd6bhoqt.vercel.app --target=staging
The following global options can be passed when using the vercel redeploy
command:
For more information on global options and their usage, refer to the options section.
Was this helpful?