getting-started

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Getting Started with Acquia CLI

Acquia CLI 入门指南

This guide covers installation, authentication, and your first commands.
Use when:
  • Installing acli for the first time
  • Authenticating with Acquia Cloud
  • Learning your first acli commands
本指南涵盖安装、认证以及入门命令的使用。
适用于以下场景:
  • 首次安装acli
  • 登录Acquia Cloud进行认证
  • 学习acli入门命令

Tool Overview

工具概述

Two separate CLIs exist for Acquia Cloud operations:
ToolPurpose
acli
General Cloud management: applications, environments, IDEs, SSH keys, code/DB sync
pipelines-cli
CI/CD pipeline operations: trigger builds, check job status, stream logs
Use pipelines-cli for anything related to pipeline jobs. Use acli for everything else.

Acquia Cloud操作有两个独立的CLI工具:
工具用途
acli
通用云管理:应用、环境、IDE、SSH密钥、代码/数据库同步
pipelines-cli
CI/CD流水线操作:触发构建、检查任务状态、流式查看日志
所有与流水线任务相关的操作请使用pipelines-cli,其他操作请使用acli

Installation

安装

macOS & Linux

macOS 与 Linux

Option 1: Native Binary (Recommended)

选项1:原生二进制文件(推荐)

The native binary requires no PHP installation and works on any modern macOS or Linux system.
bash
undefined
原生二进制文件无需安装PHP,可在任何现代macOS或Linux系统上运行。
bash
undefined

Download the latest release

下载最新版本

Make it executable

设置可执行权限

chmod +x /usr/local/bin/acli
chmod +x /usr/local/bin/acli

Verify it works

验证安装成功

acli --version
undefined
acli --version
undefined

Option 2: PHP Archive (PHAR)

选项2:PHP归档文件(PHAR)

If you prefer or already have PHP 8.2 installed:
bash
curl -fsSL https://github.com/acquia/cli/releases/latest/download/acli.phar \
  -o /usr/local/bin/acli.phar
chmod +x /usr/local/bin/acli.phar
如果您偏好或已安装PHP 8.2:
bash
curl -fsSL https://github.com/acquia/cli/releases/latest/download/acli.phar \
  -o /usr/local/bin/acli.phar
chmod +x /usr/local/bin/acli.phar

Use as:

使用方式:

acli.phar --version
acli.phar --version

Or create an alias

或创建别名

alias acli='acli.phar'
undefined
alias acli='acli.phar'
undefined

Using Homebrew (macOS)

使用Homebrew安装(macOS)

bash
brew tap acquia/cli
brew install acli
acli --version

bash
brew tap acquia/cli
brew install acli
acli --version

Your First Command: Authentication

首个命令:身份认证

Acquia CLI uses OAuth to authenticate with your Acquia account. You'll only need to do this once.
bash
acli auth:login
This will:
  1. Open your browser
  2. Prompt you to authorize Acquia CLI
  3. Generate an access token
  4. Store it locally in
    ~/.acquia/cloud_api/credentials.json
    (encrypted)
Tokens are valid for 30 days. If your token expires, run
acli auth:login
again.
Acquia CLI使用OAuth对您的Acquia账号进行认证,仅需执行一次该操作。
bash
acli auth:login
执行该命令会:
  1. 打开浏览器
  2. 提示您授权Acquia CLI
  3. 生成访问令牌
  4. 将令牌加密存储在本地
    ~/.acquia/cloud_api/credentials.json
    文件中
令牌有效期为30天。如果令牌过期,重新运行
acli auth:login
即可。

Verify Authentication

验证认证状态

bash
acli auth:me
Shows your name, email, and account information.

bash
acli auth:me
该命令会显示您的姓名、邮箱及账号信息。

Your First Command: List Applications

首个命令:列出应用

See which applications you have access to:
bash
acli api:applications:list
Output:
Select a Cloud Platform application:
  [0] My First App (prod, staging, dev)
  [1] Client Project (prod, staging)
  [2] Development App (dev)

查看您有权访问的应用:
bash
acli api:applications:list
输出示例:
Select a Cloud Platform application:
  [0] My First App (prod, staging, dev)
  [1] Client Project (prod, staging)
  [2] Development App (dev)

Shell Completion

Shell自动补全

Enable tab completion for faster command entry.
启用Tab补全功能以加快命令输入速度。

Bash

Bash

bash
eval "$(acli shell:complete bash)"
Add to
~/.bashrc
for permanent setup:
bash
echo 'eval "$(acli shell:complete bash)"' >> ~/.bashrc
source ~/.bashrc
bash
eval "$(acli shell:complete bash)"
添加到
~/.bashrc
文件以永久启用:
bash
echo 'eval "$(acli shell:complete bash)"' >> ~/.bashrc
source ~/.bashrc

Zsh

Zsh

bash
eval "$(acli shell:complete zsh)"
Add to
~/.zshrc
:
bash
echo 'eval "$(acli shell:complete zsh)"' >> ~/.zshrc
source ~/.zshrc
bash
eval "$(acli shell:complete zsh)"
添加到
~/.zshrc
文件:
bash
echo 'eval "$(acli shell:complete zsh)"' >> ~/.zshrc
source ~/.zshrc

Fish

Fish

bash
acli shell:complete fish | source
Add to
~/.config/fish/config.fish
:
bash
acli shell:complete fish | source

bash
acli shell:complete fish | source
添加到
~/.config/fish/config.fish
文件:
bash
acli shell:complete fish | source

Getting Help

获取帮助

Command Help

命令帮助

Every command has a built-in help page:
bash
undefined
每个命令都内置帮助页面:
bash
undefined

General help

通用帮助

acli --help acli -h
acli --help acli -h

Help for a specific command

特定命令的帮助

acli ide:create --help acli ide:create -h
acli ide:create --help acli ide:create -h

List all available commands by category

按分类列出所有可用命令

acli list
undefined
acli list
undefined

Verbose Output

详细输出

For debugging, show detailed output:
bash
undefined
如需调试,可显示详细输出:
bash
undefined

-v (normal), -vv (detailed), -vvv (very detailed)

-v(普通详细度)、-vv(详细)、-vvv(非常详细)

acli ide:list -vvv acli ide:create -v
undefined
acli ide:list -vvv acli ide:create -v
undefined

Debug Mode

调试模式

Run any command in debug mode to see behind-the-scenes details:
bash
acli ide:create --debug

在调试模式下运行任意命令以查看幕后细节:
bash
acli ide:create --debug

Configuration

配置

Config File Location

配置文件位置

Configuration is stored at:
~/.acquia/
~/.acquia/
├── cloud_api/
│   └── credentials.json       # Your API token (encrypted)
├── config.yaml                # Settings
└── cache/                      # Cached data
配置存储在:
~/.acquia/
~/.acquia/
├── cloud_api/
│   └── credentials.json       # 您的API令牌(已加密)
├── config.yaml                # 设置项
└── cache/                      # 缓存数据

Linking a Local Project

关联本地项目

Run
acli app:link
in your project directory to associate it with a Cloud application. See Application Management for details.

在项目目录中运行
acli app:link
,将其与Cloud应用关联。详情请查看**应用管理**。

Common First Steps

常见入门步骤

Step 1: Authenticate

步骤1:身份认证

bash
acli auth:login
acli auth:me
bash
acli auth:login
acli auth:me

Step 2: Set Up a Project

步骤2:设置项目

bash
cd /path/to/project
acli app:link
bash
cd /path/to/project
acli app:link

Step 3: Create an IDE (or connect to existing)

步骤3:创建IDE(或连接现有IDE)

bash
acli ide:create    # Create a new one
bash
acli ide:create    # 创建新IDE

OR

acli ide:list # Connect to existing
undefined
acli ide:list # 连接现有IDE
undefined

Step 4: Set Up SSH

步骤4:设置SSH

bash
acli ssh-key:list   # See your SSH keys
bash
acli ssh-key:list   # 查看您的SSH密钥

If no keys, create one

如果没有密钥,创建一个

acli ssh-key:create
undefined
acli ssh-key:create
undefined

Step 5: Try a Drush Command

步骤5:尝试Drush命令

bash
acli remote:drush status
acli remote:drush cr   # Clear caches

bash
acli remote:drush status
acli remote:drush cr   # 清除缓存

Troubleshooting

故障排除

"Command not found: acli"

"Command not found: acli"

Make sure the binary is in your
PATH
. Try:
bash
which acli
确保二进制文件在您的
PATH
中。尝试:
bash
which acli

If nothing, add to PATH

如果无输出,添加到PATH

export PATH="/usr/local/bin:$PATH" acli --version
undefined
export PATH="/usr/local/bin:$PATH" acli --version
undefined

"Error: Failed to authenticate"

"Error: Failed to authenticate"

Your token has expired or isn't valid. Try:
bash
acli auth:login
您的令牌已过期或无效。尝试:
bash
acli auth:login

"Error: Access denied"

"Error: Access denied"

You don't have permission to access that application or resource. Check:
  • Are you logged in with the right Acquia account?
  • Do you have permissions in Acquia Cloud UI?
Run
acli auth:me
to verify you're using the right account.
您无权访问该应用或资源。检查:
  • 您是否使用正确的Acquia账号登录?
  • 您在Acquia Cloud UI中是否拥有相应权限?
运行
acli auth:me
以验证您使用的账号是否正确。

Need more help?

需要更多帮助?

See Troubleshooting Guide for more issues.

查看**故障排除指南**了解更多问题解决方案。

Acquia Site Factory (ACSF) Authentication

Acquia Site Factory (ACSF) 认证

If your organization uses Acquia Site Factory, register separate credentials:
bash
acli auth:acsf-login
Options:
bash
acli auth:acsf-login \
  --username=myuser \
  --key=MY_API_KEY \
  --factory-url=https://www.myfactory.com
To log out:
bash
acli auth:acsf-logout

如果您的组织使用Acquia Site Factory,请注册单独的凭证:
bash
acli auth:acsf-login
可选参数:
bash
acli auth:acsf-login \
  --username=myuser \
  --key=MY_API_KEY \
  --factory-url=https://www.myfactory.com
登出命令:
bash
acli auth:acsf-logout

Cache Management

缓存管理

Clear local acli caches (useful when commands behave unexpectedly):
bash
acli self:clear-caches
Aliases:
acli cc
,
acli cr

清除本地acli缓存(当命令行为异常时非常有用):
bash
acli self:clear-caches
别名:
acli cc
,
acli cr

Telemetry

遥测数据

acli collects anonymous usage data by default to help improve the tool. To opt out:
bash
acli self:telemetry:disable
To re-enable:
bash
acli self:telemetry:enable
Toggle interactively:
bash
acli self:telemetry:toggle
Alias:
acli telemetry

默认情况下,acli会收集匿名使用数据以帮助改进工具。如需退出:
bash
acli self:telemetry:disable
重新启用:
bash
acli self:telemetry:enable
交互式切换:
bash
acli self:telemetry:toggle
别名:
acli telemetry

Open Product Documentation

打开产品文档

Open Acquia product docs in your browser:
bash
acli docs
For a specific product:
bash
acli docs acli
acli docs cloud-ide

在浏览器中打开Acquia产品文档:
bash
acli docs
打开特定产品的文档:
bash
acli docs acli
acli docs cloud-ide

Best Practices

最佳实践

  1. Authenticate first — Run
    acli auth:login
    before anything else; most commands require it.
  2. Discover commands — Use
    acli list
    to see all available commands grouped by topic.
  3. Enable shell completion — Run
    acli shell:complete
    once to get tab-completion for commands and flags.
  4. Verify your setup — Run
    acli self:info
    to confirm your authenticated identity and acli version.
  5. Stay updated — Run
    acli self:update
    regularly to get bug fixes and new features.
  6. Clear caches on odd behavior — Run
    acli self:clear-caches
    if commands return unexpected results.

  1. 先完成认证 — 在执行其他操作前先运行
    acli auth:login
    ;大多数命令都需要认证。
  2. 探索命令 — 使用
    acli list
    查看所有按主题分组的可用命令。
  3. 启用Shell自动补全 — 运行一次
    acli shell:complete
    即可获得命令和参数的Tab补全功能。
  4. 验证设置 — 运行
    acli self:info
    确认您的认证身份和acli版本。
  5. 保持更新 — 定期运行
    acli self:update
    以获取bug修复和新功能。
  6. 异常时清除缓存 — 如果命令返回意外结果,运行
    acli self:clear-caches

Next Steps

下一步

Now that you're set up, try:
  • Create your first IDE — Set up a development environment
  • Explore applications — Learn about your apps
  • Set up SSH keys — Secure authentication
完成设置后,您可以尝试:
  • 创建首个IDE — 搭建开发环境
  • 探索应用 — 了解您的应用
  • 设置SSH密钥 — 安全认证