[ Home ] [ Index ]

GitOnSharedHost

Created Friday 02 December 2022

Recently I set up read-only Git repository hosting on Dreamhost for my project JACL. This was kind of tricky, so here are the steps:

  1. In the Dreamhost control panel, set up SSH for a user.
  2. Once you can log in with a password, you probably want to set up key-based authentication.
  3. On the remote host, cd into the directory corresponding to your hosted domain.
  4. mkdir your-repo.git
  5. cd your-repo.git
  6. git init --bare
  7. Back in your local repo, run a command like the following: git remote add origin ssh://user@northbend.dreamhost.com:/home/user/example.com/your-repo.git substituting user, northbend.dreamhost.com, and example.com with your particulars.
  8. git push -u origin master
  9. Finally, on the remote host and in the your-repo.git directory, run git update-server-info
    1. If you don't do this, you might get the error warning: You appear to have cloned an empty repository.
  10. Now, you should be able to git push and anyone on the Internet should be able to git clone https://example.com/your-repo.git