Introduction
Error Code 128 in cPanel typically occurs when trying to create or clone a Git repository using the cPanel Git™ Version Control tool. The error message is as follows:
Why This Happens
This error arises when your remote Git repository rejects access due to incorrect or missing authentication credentials. The most common cause is an issue with SSH key authentication or using the wrong protocol to connect to the repository.
How to Fix Git Error Code 128
Step 1: Use SSH Protocol for the Repository URL
- If you’re using an HTTPS URL or plain Git URL, replace it with the SSH URL.
- SSH URLs typically start with
ssh://orgit@(e.g.,[email protected]:username/repository.git).
- SSH URLs typically start with
- SSH is required because cPanel's Terminal enforces authentication through SSH keys for security.
Step 2: Generate and Configure SSH Key
If you don’t already have an SSH key configured, follow these steps:
-
Generate an SSH Key: Run the following command in cPanel's Terminal (accessible via cPanel >> Home >> Advanced >> Terminal):
- Replace
"[email protected]"with your email address or username. - When prompted for a passphrase, press Enter to skip.
- Replace
-
Check if the SSH Key Exists: Verify the generated key with:
If the output displays a valid SSH key (
ssh-rsa AAAAB3Nza...), your key is correctly configured.
Step 3: Register the SSH Key with Your Git Provider
You need to add the public SSH key to your Git repository provider (e.g., GitHub, GitLab, Bitbucket). Here's how to do it on GitHub:
- Log in to your GitHub account.
- Navigate to Settings > SSH and GPG keys.
- Click New SSH key.
- Add a Title and paste the public SSH key from Step 2 into the Key field.
- Save the changes by clicking Add SSH Key.
For other Git providers, refer to their documentation on how to add SSH keys.
Step 4: Test SSH Key Authentication
To ensure the SSH key is working, test the connection with:
If successful, you’ll see a message confirming authentication (e.g., "Hi username! You've successfully authenticated.").
Step 5: Clone the Repository
After setting up SSH access, clone the repository with:
Replace username/repository.git with the actual repository URL.
Additional Notes
- Ensure you have the correct access rights for the repository (read/write as required).
- If you’re cloning a private repository, double-check the permissions and access tokens in your Git provider's settings.
- You can refer to this detailed guide on setting up private repository access using Git.
By following these steps, you should be able to resolve Git Error Code 128 in cPanel and successfully create or clone a private repository.
