Blocked Port 2222 Workaround
Learn how to access Port 2222 with an SSH tunnel if it's blocked.Discuss in our Forum Discuss in Slack
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 codeserver.dev.
.drush.in port 2222: No route to host Fatal: Could not read from remote repository.
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@example.com
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 -L3333:codeserver.dev.<site UUID>.drush.in:2222 firstname.lastname@example.org
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.
Open a second terminal window.
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://codeserver.dev.<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.
Verify that the SSH tunnel is open.
Run code similar to the example below:
git remote add pantheon ssh://codeserver.dev.<site UUID>@localhost:3333/~/repository.git
Git Commands Stopped Working
Follow the steps below if your Git commands stop working.
Navigate to the original terminal window.
Check if the tunnel has collapsed.
Close the tunnel and then reopen it.
Refer to the Git over an ssh tunnel article for more information.