Pushing your DreamHost Git repository to GitHub

It's always a good idea to keep a copy of your repository on an external server in case your local copy is deleted. There are two general ways you can go about this:

  • Create your application and Git repository on your DreamHost server. Then, you can push to GitHub
  • Create your application and Git repository on your home computer. Once it's ready, push the repo to your DreamHost server.

These two options are detailed below.

Pushing your DreamHost repository to GitHub

If you've developed your site on your DreamHost server, it's recommended to put a copy on GitHub for two main purposes:

  • This creates an external backup of your code, and
  • It makes future collaboration with other developers much easier.

Follow these steps to push your repository to GitHub

  1. Sign up at GitHub.
  2. Create a public or private repository in your GitHub account without a README file.
  3. Once created, github.com shows you several commands to run to push your git repository to their servers.
  4. Log into your DreamHost server via SSH and navigate to your application folder where you set up your git repository.
  5. Run the following command to push your app to GitHub:

    The word 'origin' is just an alias. It can be named anything you want. But this alias name will be used when you push your content to github.com as shown in the next step.

    'repo_name' is the name of the repository you created at github.com. Make sure .git is at the end.

    [server]$ git remote add origin https://github.com/github_username>/repo_name.git
    View the following links for details:
  6. Push your repository to GitHub
    [server]$ git push -u origin master
    View the following link for details:
  7. Visit your repository at github.com and you'll see that all files have been added.

See also

Did this article answer your questions?

Article last updated .