Skip to main content

Blocked Port 2222 Workaround

Learn how to access Port 2222 with an SSH tunnel if it's blocked.

This section provides a workaround to allow you to access port 2222 if it is blocked.

You must have access to port 2222 to push and pull code to your Pantheon site. You will receive an error similar to the one below if the port is blocked as a result of a corporate firewall or router configuration.

SSH: connect to host port 2222: No route to host
Fatal: Could not read from remote repository.

Workaround Prerequisites

You must have the following to use the workaround outlined in this section:

  • SSH access to another server outside of your network that can access port 2222 and reach Pantheon's Git servers.

  • The ability to run the open tunnel command before performing any remote Git operations.

Set up the SSH Tunnel

Open a terminal window and initiate the SSH tunnel:

ssh -L<local port #>:<pantheon server>:<pantheon port> [email protected]

The following example includes Pantheon credentials (site UUID omitted). You can use the port numbers from this example (you must leave port 2222 in place).

ssh<site UUID> [email protected]

You should now be logged in to the other server, but simultaneously you've just set up your local port 3333 as a tunnel to your Pantheon Git repo.

Clone the Repository

You must have a fully cloned repository to push and pull changes from.

  1. Open a second terminal window.

  2. Replace the repository URL before you run the command below to clone the repository.

    git clone <Pantheon repository URL>@localhost:3333/~/repository.git

    Here's an example with Pantheon credentials (site UUID omitted):

    git clone ssh://<site UUID>:3333/~/repository.git

Add a Remote (Optional)

You can add a remote repository if you use GitHub or Bitbucket in parallel, for example.

  1. Verify that the SSH tunnel is open.

  2. Run code similar to the example below:

    git remote add pantheon ssh://<site UUID>@localhost:3333/~/repository.git

Additional Information

Git Commands Stopped Working

Follow the steps below if your Git commands stop working.

  1. Navigate to the original terminal window.

  2. Check if the tunnel has collapsed.

  3. Close the tunnel and then reopen it.

Refer to the Git over an ssh tunnel article for more information.

More Resources