Skip to main content

Troubleshooting

Get solutions to common Git troubleshooting scenarios.


This section provides solutions to common Git troubleshooting scenarios.

Reduce Large Repositories

Repositories that exceed 2GB may experience failures or degraded performance when interacting with code via Git on Pantheon. We recommend that you reduce the repository size by removing objects that are no longer referenced. You can output the size of your repository by running git count-objects -vH or du -sh .git/ from within the root directory of your site's codebase.

We recommend that you use git filter-repo to reduce the size of your repository.

Warning:
Caution

The instructions for git-filter-repo are advanced, and may not work in every case. You should only attempt the steps to reduce repository size if you are an experienced Git user.

  1. Make sure you have a remote in Github, Bitbucket, or Gitlab with a full copy of your repository.

  2. Follow the steps in the git-filter-repo INSTALL.md file to download and install git-filter-repo.

  3. Refer to the git-filter-repo User manual for instructions on how to reduce the size of your repository.

You should be able to run commands similar to the example below after you install git-filter-repo.

Example to remove one file:

git filter-repo --path wp-content/themes/mytheme/assets/images/largefile.mp4 --invert-paths

Authenticity & Fingerprint Prompts

Your first connection to any remote server over an SSH connection (like Git or SFTP) will prompt you to confirm the host identity:

The authenticity of host '[codeserver.dev.UUID.drush.in]:2222 ([IP.ADDRESS]:2222)' can't be established.
RSA key fingerprint is SHA256:yPEkh1Amd9WFBSP5syXD5rhUByTjaKBxQnlb5CahZZE.
Are you sure you want to continue connecting (yes/no)?

You can safely type yes and press enter to add the server's SSH key fingerprint to your computer's known_hosts file. Additional connections to this specific Pantheon container will complete successfully without prompts. However, you will be prompted to confirm connections following a container migration, which is part of regular maintenance on the platform. See the following Pro Tip to automatically accept all Pantheon connections.

Pro Tip: Trust All Pantheon Hosts

The key fingerprint is a representation of the public key, used by the remote server to identify itself. These public keys, along with private keys, form a keypair used by the Diffie-Hellman key exchange to encrypt communication between you and the server.

On a standard server system, the server administrator would publish their host keys and fingerprints publicly, so clients could match them to the keys presented at these prompts. On Pantheon however, application containers are created and destroyed too rapidly to maintain a public key list.

You can, however, easily tell your machine to automatically trust all Pantheon *.drush.in servers by disabling the StrictHostKeyChecking option in your SSH configuration file.

Warning:
Warning

Be aware that this disables a security feature and trusts your DNS system to always point you to the right IP addresses.

Open ~/.ssh/config (or create a new file if one does not exist) and add the following lines:

~/.ssh/config
Host *.drush.in
    StrictHostKeyChecking no

Now, requests to any *.drush.in server address should automatically accept the server's SSH key fingerprint without prompting you.

Checking Out Code using GUI Clients

Git GUI clients generally prompt for a Source URL using HTTP or HTTPS to the repository to check out the site code. Pantheon does not provide Git repository access over HTTP(s), and instead provides a "Git over SSH" command. For example:

git clone ssh://[email protected]:2222/~/repository.git my-site

However, some Git GUI clients, including SourceTree, also support the use of ssh:// URLs to clone the code base. Follow the steps below to configure the URL.

  1. Navigate to your Pantheon Dev environment > click Connection Info > copy the SSH clone URL.

  2. Navigate to SourceTree > click Clone a repository.

  3. Paste the URL into the Source URL field.

    1. Remove git clone from the beginning of the URL.

    2. Remove the trailing space and my-site name from the end of the URL provided in the Connection Info section of your Pantheon Dashboard.

      Your Source URL should look like this:

      ssh://[email protected]:2222/~/repository.git
  4. Enter the local path where you want to clone the repository in the Destination Path field.

  5. Enter your site name in the the Name field.

SourceTree git Configuration

Alternatively, you can simply clone the repository using git clone and then use the "Add Existing Local Repository" option in SourceTree to point to the checked out directory.

Blocked Port

You'll see an error like the one below when attempting to run git clone, git push, or git pull if your local network is blocking port 2222.

ssh: connect to host codeserver.dev.xxx.drush.in port 2222: Operation timed out
fatal: Could not read from remote repository.

To clear this up, you may need to work with your network administrators to unblock this port. If this isn't an option, you may need to try a Port 2222 Blocked Workaround.

Debug CI pipeline failures

If your continuous integration pipeline is suddenly failing across a large portfolio of sites due to permission denied errors for Git/SSH authentication, we recommend debugging local DNS cache to solve.

More Resources

We recommend the following resources for further learning:

For Pantheon-specific Git questions, see the following: