cPanel + Git – ‘Git’ them to play nice on GoDaddy web hosting

Github Logo
Github Logo

I decided to do some more work on Archiver (read more here) to re-write the front-end using Bootstrap.  I was looking for an end-to-end dev / production environment managed completely through GitHub (I made a repo 2 years ago but hadn’t touched it since).

I pulled and pushed code with my Linux Mint VM perfectly fine, but had some difficulty on the server side.  To my surprise, Git was already installed when I connected via SSH to my GoDaddy web hosting account .  However, cPanel Git is a bit different than using Git on a dedicated server.   It took a little while to figure it out, so I thought I’d share the steps it took to make everything work correctly.  I kept getting the error, “The requested URL returned error: 403 Forbidden while accessing”, and found a solution after a bit of searching.

Note: These directions assume that you have connected via SSH to your cPanel GoDaddy web hosting account.

  1. Set your name and email so your commits are labeled correctly.
    $ git config --global user.name "Your Name Here"
    $ git config --global user.email "[email protected]"
  2. Assuming you’ve already forked the repository, clone the fork.
    $ git clone https://github.com/ifyouwillit/Archiver.git
  3. Add a changed file.
    $ git add somefile.php
  4. Commit your changes.
    $ git commit -m "[your commit note here]"
  5. Push your changes (I’m using the actual URL instead of ‘remote’ to illustrate the change).
    $ git push -u https://github.com/[GITHUB_USERNAME]/[REPO_NAME].git

    But WAIT. You will probably get an error if you’re using cPanel Git on GoDaddy.

    error: The requested URL returned error: 403 Forbidden while accessing https://github.com/ifyouwillit/Archiver.git/info/refs fatal: HTTP request failed.

    To correct the error, make the following change…

  6. $ git push -u https://[GITHUB_USERNAME]@github.com/[GITHUB_USERNAME]/[REPO_NAME].git

    Notice the base URL has changed.
    https://[email protected]/ifyouwillit/Archiver.git
    vs
    https://github.com/ifyouwillit/Archiver.git

And there ya have it.  If you have comments or questions, leave them in the comment section below.

By the way, I can’t take all the credit.  Jess is the one that originally saved me!

3 thoughts on “cPanel + Git – ‘Git’ them to play nice on GoDaddy web hosting”

  1. This instruction saved me. BTW, did you manage to set git password on GoDaddy so that you don’t have to repeat typing it every command?

Leave a Comment

Your email address will not be published. Required fields are marked *

Posted in