Site5 - Built For Designers & Developers MENU
Home  ›  Programming Tools  ›  Creating a new GIT repository

Creating a new GIT repository


This tutorial will show you how to create a new GIT repository on your Site5 account. GIT is an alternative to Subversion (SVN) and is a great way to manage a code repository or project you’re working on. GIT is installed by default on all of our shared, reseller, VPS, and dedicated servers.

1. Login to your Site5 account via SSH (command line).

2. Let’s first create a folder inside of our home directory where we’ll keep all of our GIT repositories separate from our other files:

mkdir ~/git

Note: The “git” directory is where we are going to store all of our repositories. For this tutorial, my test project will simply be called “project.” I’m going to walk you through setting up a fresh git repository on a blank project, but if you already have a project on your machine, now would be the time to upload it to the “git” directory we just created.

3. Let’s create a new GIT project:

cd ~/git; mkdir project.git; cd project.git

4. Next, we will initialize our GIT repository:

git init

After you run the above command, the output will look something like the below:

Initialized empty Git repository in /home/user/git/project.git/.git/

5. We can then add some sample files to our new project:

cd ~/git/project.git; touch test1; touch test2
echo "Site5 Is The Greatest" > test1; echo "testing" > test2

6. After we have added the test files, we need to “add” them to our repository:

git add test1 test2

7. Now we can “commit” the changes to our repository:

git commit -a -v

The above command will open a new window in your default command-line text editor asking for a commit message. You can type whatever you want here.

8. After you commit your changes, you can check the status of the repository: [~]# git status
# On branch master
nothing to commit (working directory clean)

Still have a question? Or need help?
If you need technical support with your account, please email us or chat live with a representative.


  • Thanks for making git available to site5 users!

    2 questions:

    1) Once I set up a git repository on my Site5 server, can I manipulate the repository from another machine? For instance, can I do commits from my Windows computer? If so, what will the repository URL be?

    2) I would like to have my website serve up the source code from the repository, without allowing users to make updates to the code. If this is possible, what URL would be used to browse the source code?


    Eric Terrell

    • 1) You can access the repository from any machine you have SSH access on. The URL should be the same from computer to computer.

      2) Take a look at the URL posted below. If you just need “read-only” access on your website, that link should work for you (just ignore the write access and Webdav part). You can just use .htaccess files for all of the allow/deny and password protection.

      I hope this helps!

      • Hi!
        Is there a way to have write access (push) from another PC?
        Using something like git-http-backend and allowing me to configure users or groups(Like this article


        • Hello Emilio,

          You can push from any computer, so long as your login credentials are correct. However at this time, there is no way to do what that link describes on our services.

          • Hey John – I was just wondering, is there any chance that a request to have git-http-backend installed might be granted?

            • Hello Michael,

              Thank you for your comment. Because of the way our backend and security works, this is not something that we would allow. We do not allow daemons to be run by clients and the git-http-backend requires a daemon to work properly. You might be able to find a cgi or php script that runs without a daemon, but I am not aware of any at this point in time.

              When our unmanaged VPS services are launched, you could do it there. More information about our new VPS services will be posted on our blog when the time comes.

              • Ahh, that’s a shame, but understandable – cheers, John!

    • ” The URL should be the same from computer to computer.”

      But.. the same as what?

  • So I have been try to get all of this figured out. I am new to both Git and SSH. I have been able to establish an SSH connection using both Cygwin and PuTTY. I have also been able to create a repository on my hosted account. Where I am stuck is with actually using it. What I have gotten out of what you have already stated is that it is not possible for me to do “git commit” from my local machine, and I think I understand the reason why. What I have tried to do is “git clone ssh://” and it still doesn’t work. It asks me for my password, which I give it. And then it comes back and says “The server’s host key is not cached in the registry. You have no guarantee that the server is the computer you think it is.” I found this post and tried what he said but it still doesn’t work. And I have verified that the host/domain is in the known_hosts file.

    What am I doing wrong. Or am I completely misunderstanding this and what I am trying to do is not possible at all.

    Thanks for your help in advance.

  • I keep getting the following when trying to run git push origin master from my mac. I was able to clone the remote repo fine, add a new file and commit it, but I can’t push:

    Joshs-iMac:scotch josh$ git push origin master
    error: Cannot access URL, return code 22
    fatal: git-http-push failed

    my ssh keys work fine, so I am not sure what the issue is.


    • Unfortunately that is a generic error and can be hard to nail down the cause sometimes.

      Could you try using the user/pass combo rather then your key to see if that lets you push?

      Could you try using git:// and ssh:// for your URL prefix to see if either one works? Again I just want to test a few different things that may be causing this problem.

      You may also be interested in something like the following:

      • I’ll give that a whirl and see how is goes, Thanks for the resposne!

      • Neither seem to working. When I try ssh://, it get “the directory scotch.git/.git does not appear to be a git directory, but that is the same directory that the clone checked out and it worked fine. when I try git:// it just times out and gives me:

        fatal: unable to connect to[0: MYIPADDRESS]: errno=Operation timed out

        • Josh,

          The .git directory inside your repo is not a repo itself it just contains all git objects and stuff.

          Also, you cannot push via HTTP or GIT (unless theres a demon running, like in GitHub), for this kind of environment you want to stick with SSH for pulling and cloning (unless you wanna change your remotes manually every time you clone).

          Try this:
          git clone ssh://user@server/scotch.git

          If you remote repo is set as bare please remember you need to specify the branch on your first push or it will fail:

          git push origin master otherwise a simple git push will do

          Hope this helps :)

  • Hi!

    I can I do a clone from my windows or linux pc?
    I created a repository in and if I try to clone it with “” I get this error:
    “fatal: not found: did you run git update-server-info on the server?”
    If I try with “” I get this error:
    “fatal: repository ‘’ does not exist”

    What am I doing wrong? :(

    • Hello Daniel,

      This could be caused by a large number of things. Because of the nature of this error, I recommend that you open a ticket with our support team via Backstage so we can take a detailed look at your account.

      Happy Hosting!

  • What should I do? Is this even the right URL?

    git clone ssh://
    Cloning into ‘project’…
    Connection closed by [IP]
    fatal: The remote end hung up unexpectedly

    I can ssh with putty.
    project’s .git is at /home/myusername/git/project/.git

  • We worked it out:

    the correct command would be

    git clone

    • Thanks Devon, that syntax for cloning was really helpful. +1

  • Thanks for the guide! I am on shared hosting; is it possible/allowed to give a small number users access to this repository, as a sort of a private GitHub repository, without giving them general access to the site and domain management?

    That is, I’d like to do something like what I can do with e-mail addresses: set up several USERNAMEs@MYDOMAIN, each with its own password and its privileges limited to pulling from and pushing to the git repository.

    • Hello Pavel,

      Yes, you can allow access to remote users. They would simply need the name of your repository and the URL to use to connect. As for password protecting it, and setting up users for this, it would not be possible on a managed service.

  • We just got this working, here’s what you have to do:

    1) You should use SSH not HTTP
    2) You should set up a bare repo on your server
    3) If you commit your bare repo through SSH it will work

    On sever:

    – SSH into your account (Win 10 users can use powershell `ssh`)
    – `cd` into “deploy” directory (you need separate “deploy” and “public” dirs)
    – run `git init –bare app.git`

    On PC:

    – Init `git` in your application root
    – `git remote add site5 ssh://[username]/path/to/app.git`
    – `git add .`
    – `git commit -a -m “Initial”`
    – `git push site master`

    On server:

    – The repo should have been “pushed”
    – You should add a `post-receive` hook to test if it works:

    echo “Test”

    If you push again, the “Test” message should appear.

    Doing this will assure the system works, and you’ll be able to add to your `post-receive` hook to deploy the code to a “public” directory.

Money Back Guarantees