Installing Git on Godaddy

& so I was sitting and pondering upon which revision control system I should deploy for an ongoing project, seeing that I’ll be needing someone to work on my application UI design in the near future, when my good friend Sola Ajayi, an avid & well matured developer swayed me towards Git. After much persuasion on the benefits, I decided to give it a go, and I’m certainly glad I did.

So what is Git?

Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git is used for version control of files, much like tools such as Mercurial, Bazaar, Subversion, CVS, Perforce, and Team Foundation Server.


I have a shared dedicated hosting plan with, while my actual development files are local on my system. I needed a scenario where once i’m done with a web-dev session, I would only upload files I modified and keep track of those changes rather than the whole project.

What you need:

  1. A GoDaddy hosting account: Obviously this tutorial assumes you have a GoDaddy hosting account or you intend to use one. The steps described below in installing Git are unique to GoDaddy because they use CentOS 5 linux operating system [at least my hosting account uses that]. so it will only work on other hosting servers if they are similar to GoDaddy’s configuration.
  2. Some Git knowledge: If you don’t have any experience or knowledge you can find some in their Community Book.
  3. Git installed: You need git installed on your local machine: Download from Git Website.
  4. SSH client: Hopefully if you installed properly from step 3 above you should have this installed.
  5. Bash shell on local machine: Same as step 4.

Setup Git on GaDaddy

As you know, Git is not installed on GoDaddy by default, and since the assumption is that you don’t have root access you’ll have to copy pre-complied binaries for CentOS 5 provided below to your hosting account on GoDaddy, so lets get cracking.
  • Step One: Enable SSH for your GoDaddy hosting account. GoDaddy documentation can be found on their help pages. Note that it takes some time for SSH access to come up, once its up you may proceed.
  • Step Two: Make sure you have at least one FTP account created.
  • Step Three: Setup password-less authentication using Public/Private keys on your ssh account. Here’s a tutorial if you need help:  Password-less SSH
  • Step Four: Use Git Bash Shell [Should be in you programs line up] Connect to your ssh account using the following:

    Use your ftp user login as “username” and the hosting account domain as “domain”. If it’s your first time connecting via ssh, it should ask you to add the domain to the list of know hosts, type yes and continue.

  • Step Five: Download the git binaries to your GoDaddy account by running the following command:

    These binaries were compiled from the GIT (version on a linix machine running CentOS 5.2, which is the same operating system that my GoDaddy hostng account is running. Usually, linux binaries are relatively portable so these might also work on other servers running a different operating system. In the event they do not work, you can compile them yourself using a virtual machine with the same OS specifications as your web host uses.

  • Unpack your freshly downloaded binaries using the following command:
    tar -xvjf git-
  • Now use your favourite text editor and add the following lines to the bottom of this file: ~/.bashrc
    export GIT_BIN=${HOME}/git
    export PATH=${GIT_BIN}/bin:${PATH}
    export GIT_EXEC_PATH=${GIT_BIN}/libexec/git-core

    Note: if the file ~/.bashrc does not exist, create it and copy those lines to it. After adding those lines, you’ll have to modify ~/.ssh/authorized_keys file, Here’s a sample of my ~/.ssh/authorized_keys file:

    ssh-rsa AAAAB3NzaC1yc2
    7z3/hfNJLjgEO6yKIkY8Y29gj86KjfZVU2tQ== Chuka@CHUKA-PC

    Next add the following code to the beginning of the file:

    command="if [[ \"x${SSH_ORIGINAL_COMMAND}x\" == \"xx\" ]]; then /bin/bash; else source ~/.bashrc; eval \"${SSH_ORIGINAL_COMMAND}\"; fi; "

    This tells your ssh session where it can find your git binaries every time you login remotely via ssh and try to run a command.

  • The next step is to initialize a bare repository on your GoDaddy servers to which you will be publishing from your local server. Create a folder in your hosting account home folder named “repo”, change directories to it and run the following commands:
    mkdir ~/repo
    git init –bare –template ~/git/share/git-core/templates ~/repo/app_name.git
    cd ~/repo/app_name.git
    git update-server-info

    After creating your online repository, you may logout from your GoDaddy server.

Setup & Publish your local repository

Here, you’ll be initializing and setting up a new local Git repository (You can use your development IDE, NetBeans in my case to do this if it has a Git plugin) and tell your local repository where to publish your file to on GoDaddy’s server. For the purposes of this tutorial I will be using “app_name” as project name.

  1. Change directories to your local application folder and run the following commands, don’t forget to substitute your local application path.
    cd /c/xammp/htdocs/app_name/
    git init
  2. Next step is to add all files in your app to your local repository. But before that, Git records your name and email address with every commit you make, so you’ll need to tell Git what these are. Run following commands:
    git config –global ‘Your Name’
    git config –global ‘’
  3. Next, we add all files to the repository and then we commit everything
    git add .
    git commit -m “Initial Commit” .
  4. Next we’ll tell our local server where to find our GoDaddy online repository which we setup in the previous section of this tutorial:
    git remote add origin ssh://

    Note that we used a “/” after the domain syntax instead of “:” as we would normally would for ssh.

  5. We are now ready to do our initial push to GoDaddy servers online:
    git push origin master

    If all goes well, you should be able to push your local repository to GoDaddy successfully.

  6. Now that we are able to push files online, there’s just one last bit we need to tidy up; ssh into your GoDaddy account and run the following command:
    git clone –template ~/git/share/git-core/templates ~/repo/app_name.git ~/html/app_name
    cd ~/html/app_name
    git pull

    This makes a clone of your repository and deploys files to your web-server [could also be your live-site]. The next command “git pull”, retrieves all files which has been pushed to your online repository from your local machine and makes sure its up to date.

    If you want to update your live-site automatically any time you do a “git push”, you’ll have to make use of the “post-receive” hook file. Use your favourite text editor and create the file ~/repo/app_name.git/hooks/post-receive and copy the following lines to it:

    export GIT_DIR="$WORKDIR/.git"
    echo "Starting Pull"
    cd "/FULL/PATH/TO/html/app_name"
    git pull
    echo "Pull finished Successfully"

    Note: you can get your full path by running “pwd”. Now hopefully if you followed these steps correctly, you should now be able to do a git push and update your GoDaddy repository and effect changes to your live-site at once.

I hope you found this tutorial quite helpful.
PS: I picked Sola’s brain a lot while writing this 🙂

Tags: , , , ,

34 Responses to “Installing Git on Godaddy”

  1. Arun Says:

    Very nice article, helped me a lot..
    however, there are a few mistakes here,
    1)- ‘ssh’ is wrongly spelled as ‘shh’ at some places.
    2)- command=”if [[ \”x${SSH_ORIGINAL_COMMAND}x\” == \”xx\” ]]; then /bin/bash; else source ~/.bashrc; eval \”${SSH_ORIGINAL_COMMAND}\”; fi; ”
    was not working for me when i copied it directly, when i copied this code from another webpage, it worked.
    Hope this helps!

  2. Chuka Says:

    Hello Arun, thanks for the pointers, i have updated the ‘shh’ issue, but for the 2nd one, i doubled checked that line of code, and it seems ok. Maybe when you copied: ” was replaced with “ anyways thanks a lot!

  3. Paul Says:

    Thank you for this article–I found it very helpful! I had to do a few things differently:

    1) instead of -bash, -template; –bash, –template, etc.

    2) git remote -set-url origin ssh://path/to/.git produced “no such remote ‘origin'” error; instead used git remote add origin ssh://path/to/.git

    3) git couldn’t find git-receive-pack on the server. Apparently, connecting via ssh wasn’t loading paths in either .bash_profile or .bashrc. I used –receive-pack full/path/to/git-receive-pack and that worked. Afterwards, I added the following to git config:
    git config remote.origin.uploadpack /full/path/to/git-upload-pack
    git config remote.origin.receivepack /full/path/to/git-receive-pack
    and now git push origin master works fine.

    4) while pushing, got this error:
    error: pack-objects died of signal 13
    I had to break up my project into smaller chunks and that resolved it.

    I wasn’t able to get the post-receive hook to work. I googled the problem and tried a few different solutions, including adding shebangs and “env -i git pull” to the post-receive file, but nothing seemed to work. If you have any ideas about what the problem might be, I’d love to hear them. Anyway, thanks again!

  4. Francisco Says:

    Thanks for posting this, it helped me!

  5. Thanh Nguyen Says:

    I got the hook working by add #!/bin/bash to the top of the file and them chmod 755 post-receive.

  6. XYDAC Says:

    Thanks a lot for writing this up…
    I’d like to add the problem i faced:
    1. Firstly dunno why but the curly braces in export statements didn’t work, so i removed them
    2. space should be considered when setting up ~/.bashrc file
    3. export -p command also helps..:)
    4. In your ssh file, make sure everything goes in one line…

  7. JP Says:

    thanks for this list, point #4 was tripping me up.

    The OP just says “beginning of the file”, which is slightly misleading. It should specify that that the command is prepended to the beginning of the line, without a carriage return, so the whole thing should look like this:

    command=”if [[ \”x${SSH_ORIGINAL_COMMAND}x\” == \”xx\” ]]; then /bin/bash; else source ~/.bashrc; eval \”${SSH_ORIGINAL_COMMAND}\”; fi; ” ssh-rsa AAAAB3NzaC1yc2ECCCCDAQABAAABAQDSNqqbOACGl2qyQBkPFfSL2eNxtP0W61TKIL19VQAdRcdCBF/ZJSyFYAGRmq6rgr3yVmD4f+sfP1DM4puMaldaV7nf8gx9spqyLc4CG36DIjcS5tGvNQyUqEZVvhpsRlxsJcyzyNfHZVXD78WfjLZuiggRQfqKlB1wRdzE95GZcrt3nrSgh4dx2lTwzihniuEmtZUJDLk8LTqNXE+zn+dilSRwCJwjr+2FNoOggrT+bcNm07U2l3mYTf2qFifq1CzzoYqgH5jRhpXV2Z1qkQZ28CPU14G+l7c1PBjk5efxfHhSex2bSrxFa9XUtnJyweyoho2IoYTBe+2On165CWml username@machine

  8. elihu Says:

    That fixed it for me – thanks for the comment.

  9. pano Says:

    I got cannot exec ssh permission denied error when trying to pull or push..

  10. Pano Says:

    I got exec ssh permission denied error when trying to pull or push…

  11. raarce Says:

    Same thing happened to me. Have you found a solution?

  12. Pano Says:


  13. Blandon Says:

    Hi Raarce,

    Have fixed the problem?


  14. raarce Says:

    No. I stopped trying to solve it.

  15. Blandon Says:

    Hi Pano,

    Have you resolved the ssh permission problem?


  16. Pano Says:


  17. Derrick Says:

    Hopefully this helps anyone who is having issues… took me hours to resolve!

    If you do not have ~/.bash_profile, you need to create one and use the following code to refer to the ~/.bashrc file.

    if [ -f ~/.bashrc ]; then
    . ~/.bashrc

  18. Kyle Says:

    Derrick, this worked for me. Thanks!

  19. DrupalFever Says:

    Thanks for the information you provided!

    With this information at hand I was able to make a YouTube tutorial on how to set up Git on a Godaddy Shared Hosting Account:

    Hope you like it! 🙂

  20. Sanchit Goyal Says:

    Hello !!

    Thank you so much for a wonderful post. Do you know how to setup keyless ssh on go daddy shared hosting account ? I was able to install and configure git but even though I created and published on .ssh/authorized_keys file @the server go daddy is still asking for password for login. !!!

  21. Chuka Says:

    Here’s an article that might help:

  22. j1 Says:

    What does this mean:

    ” After adding those lines, you’ll have to modify ~/.ssh/authorized_keys file, Here’s a sample of my ~/.ssh/authorized_keys file:”

    There is no explanation on how to modify the file or why this is necessary, please explain?

  23. Chuka Says:

    You can use nano or vim to modify the file and paste your public ssh key. this is required to use public key authentication so it wont ask for a password everytime.

  24. Learning about Git Hub | Stephen Chapman Says:

    […] are some accounts on the web like this one, saying that it is possible to install Git on […]

  25. Version Control: Setting Up Git on Godaddy | Sam Tobia Says:

    […] at times I just don’t want to figure things out, as such I chose to use someone elses work. This is a great Article on it. Now despite following the tutorial to a T I ran into issues, not because its a bad tutorial, […]

  26. Sam Says:

    This article was just what I needed
    There is one thing that confused me for a good 15 minutes considering my favorite text editor was notepad++, then my next favorite is notepad. So I figured this would be done locally.

    But for the ~/.bashrc you’ll want to use vi most likely since it doesn’t use an install for the commands

  27. Rania Says:

    I have followed all the steps but I am getting this error
    git: error while loading shared libraries: cannot open shared object file: No such file or directory

    Couldn’t find any solution online , I appreciate your help to fix it


  28. Kenny Says:

    I am getting the same problem, have you found a fix?

  29. Terrell Says:

    I followed these steps last night and was able to create a repo with no problem but this morning I get the same not found error

  30. Patrick Says:

    I run into the same issue recently. As it turns out, godaddy host deluxe has git pre-installed (Don’t know about other hosting variants), so you no longer need to install git or modify .bashhrc. Authorize public ssh key from Cpanel and then add that line mentioned, at the beggining of the file, leaving a space between the function and key. Then you can connect with putty(having imported the private key) and run the git commands. You can get git path by running git –exec-path.

  31. Rania Says:

    I have followed all the steps but I am getting this error
    git: error while loading shared libraries: cannot open shared object file: No such file or directory, I appreciate your help to fix it


  32. Nick Says:

    does it matter where this command is run?
    should it happen immediately after ssh to the server or should we change directories?

  33. wesley Says:

    Very good. Thanks for sharing.

  34. basant Says:

    I have followed all the steps but I am getting this error
    git: error while loading shared libraries: cannot open shared object file: No such file or directory, I appreciate your help to fix it

Leave a Reply