CLI
/
Install the CLI
Install the CLI
One command line tool for everything the dashboard does. Install it, log in once, and the rest of this section is what you can do with it.
4 min read
The CLI installs under two names, naijacloud and the shorter njc. They are
the same executable, so use whichever you prefer. These docs use the long name.
It is not nc. That is netcat, which exists on nearly every Unix machine, and
taking the name would shadow it on your PATH.
Install
npm
If you have Node.js 20 or newer:
npm install -g @naijacloud/cliYou can also run it without installing:
npx @naijacloud/cli loginThe old unscoped naijacloud-cli package is deprecated and frozen. Releases go
to @naijacloud/cli. Nothing about usage changed.
macOS
brew install naijacloud/tap/naijacloudThe formula is in the naijacloud/tap tap, not homebrew-core, so it needs the
prefix. Run brew tap naijacloud/tap once and plain brew install naijacloud
works after that.
Linux
Download the .deb or .rpm from the
latest release and install it
directly. There is no apt or yum repository to add.
Debian, Ubuntu
curl -fLO https://github.com/naijacloud/nc-cli/releases/download/v1.0.0/naijacloud_1.0.0_amd64.deb
sudo dpkg -i naijacloud_1.0.0_amd64.debRedHat, Fedora, CentOS
curl -fLO https://github.com/naijacloud/nc-cli/releases/download/v1.0.0/naijacloud-1.0.0-1.x86_64.rpm
sudo rpm -i naijacloud-1.0.0-1.x86_64.rpmBoth packages embed their own runtime, so they install on a machine that has
never seen Node. Since there is no repository behind them, apt upgrade will not
carry the CLI forward. Install a new release the same way you installed this one,
or use the install script below, which resolves the latest version for you.
Windows
scoop bucket add naijacloud https://github.com/naijacloud/scoop-bucket
scoop install naijacloudOr use the install script under WSL, or npm with Node 20 or newer.
Install script
curl -fsSL https://raw.githubusercontent.com/naijacloud/nc-cli/main/install.sh | shInstalls into your home directory, without sudo, and picks the latest release.
Read the script before you pipe it to a shell. Piping a URL into sh runs
whatever that server returns, and a swapped host owns your account the moment
you run it. Save it, read it, then run it.
Log in
naijacloud loginYou are prompted for your NaijaCloud email and password. The password is not echoed and is never written to disk. Only the returned token is stored.
The token is checked against the API before anything is saved, so a bad
credential fails immediately rather than at your next command. On success it goes
to ~/.naijacloud/config.json with mode 0600, inside a 0700 directory.
For CI or scripting:
naijacloud login --email [email protected] --password "$NC_PASSWORD"
naijacloud login --token "$NC_ACCESS_TOKEN"Check and clear:
naijacloud whoami # prints the account, or exits 1
naijacloud logout # deletes the stored credentialsConfiguration
| Variable | Default | Purpose |
|---|---|---|
HOSTING_API_TOKEN | Access token. Takes precedence over stored credentials, so you can override the account per shell | |
HOSTING_API_BASE_URL | https://api.naijacloud.com | API base URL |
HOSTING_API_TIMEOUT_MS | 30000 | Per-request timeout |
HOSTING_UPLOAD_TIMEOUT_MS | 600000 | Timeout for a static site upload, which is one large PUT rather than an API call |
NAIJACLOUD_DEPLOY_TIMEOUT_MS | 900000 | How long deploy and redeploy wait for a build to finish |
Tokens resolve in the order HOSTING_API_TOKEN, then
~/.naijacloud/config.json. With neither, every command fails with
Not logged in. Run 'naijacloud login' first. rather than a raw 401.
Check it worked
naijacloud whoami
naijacloud projects ls