Skip to content

Possible to make different aliases to same remote webhost account with only different paths on remote? #5789

@porg

Description

@porg

Documentation does not answer my use case yet

Server side

Accessing production vs. staging in the shell on the server (via SSH)

$ ssh dd

# I'm now on my webhost, executing commands there.

$ wp @dd option get blogname
DD

$ wp @dds option get blogname
DDS
  • ✅ The different aliases return different results, each corresponding to their respective WordPress instance.

~/.wp-cli/config.yml (Webhost)

# Global parameter defaults
path: /data/web/•••/html/apps/dd/

# Aliases
@dd:
  path: /data/web/•••/html/apps/dd/

@dds:
  path: /data/web/•••/html/apps/dd-staging/

Client side (Mac)

Client side aliases to access different WP instances (production and staging-subdomain) on the very same remote webhost and very same user account there

  • I'm now on my Mac.
  • Running my local wp-cli which connects to the remote wp-cli.
    • This worked fine when I only had 1 WordPress instance on that webhost account.
  • For a while I used a production and a staging server with aliases on the server, as shown in the previous section. Worked fine all time.
    • Now I had set up two aliases on my client side machine corresponding to those two remote instances too.
    • ❌ But both aliases seem to resolve to the same WP instance on the remote!
$ wp @dd option get blogname
DD

$ wp @dds option get blogname
DD
  • ❌ The last command should have returned "DDS" but returned "DD".
    • I have my dounbts that the aliases resolve correctly.
    • See my client config:

~/.wp-cli/config.yml (Mac)

# Global parameter defaults
path: ~/Web

@dd:
  ssh: dd
  path: /data/web/•••/html/apps/dd/
@dds:
  ssh: dd
  path: /data/web/•••/html/apps/dd-staging/

Questions

  1. Is it a problem that I use the same alias names client side as server side?

    • I rather rule that out.
    • I temporarily set my client side aliases to @d and @ds respectively, but it made no difference.
    • Still got the same blogname for both, depsite them being different in reality.
  2. Is the same SSH connection but different paths not enough to constitute two indeed different valid aliases?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions