Push to bluehost using Tower.app

277 views Asked by At

I'm a git newbie and got a question about pushing a repo to bluehost.

I am using Tower.app to push to Github.com and I also want to be able to push it to my account in bluehost.com not at the same time (I would like to select it from the drop down option in the Tower.app).

I need to push my project to a directory located in http://example.com/sub/y (where y is anotherdomain.com).

I've spent the last 3+ hours trying various things and couldn't get it to work. Bluehost either complained about directory not being a git repo or updating server info. I tried pushing it with ssh then http.

Can someone provide me with step by step instructions for this? THANK YOU!

1

There are 1 answers

0
Brendonwbrown On

What is your intention for pushing to a Bluehost subdirectory? Do you want to keep your website files updated for serving directly online (deployment), or are you maintaining a repository to share/back up your work? Believe me, they are very different things, and one is more complicated than the other.

Given that most people in your situation are looking to deploy via git, I would recommend the following:

  1. It is important to update git to the latest version using this tutorial, paying special attention to some corrections in the comments: http://willjackson.org/blog/installing-git-bluehost-shared-hosting.

  2. While your are SSH-ing into the server, set up a bare repository. Mind you, files in this repo will be unusable for hosting purposes, so I recommend that you create your repository directory (~/repositories), create a repo within (domain.tld.git), cd into the repo and run git init --bare.

  3. Add both Github and your Bluehost bare repository as remotes (right click Remotes in Tower sidebar > Add Remote Repository). For Bluehost, add the most relevant name (most people would call it "Production"), then add the location to be something like this, changing what's in italics: "ssh://user@domain.tld/home1/username/repositories/domain.tld.git.

  4. Push the files to the bare repo by dragging a branch (Master?) and dropping it on the Bluehost remote you set up. Name the branch (Master?) and hit OK. This should be a successful push.

  5. SSH back in, cd to the bare repo, cd into the hooks directory and create a file called post-receive. A post-receive hook is a script that git is instructed to run after receiving your changes. Build it such that it will point git to your web files subdirectory and checkout the files like so: Git site deployment - checkout in post-receive hook not working