Git push to reclaim hosting?

Hi, folks,

Here’s my scenario, what I’d like to do… This seems theoretically possible, but before I go down the road, I thought I’d ask if there might be an obstacle:

  1. I have a domain and hosting set up on cPanel, no apps installed, just filesystem.
  2. I establish a git repo in a folder on Reclaim, clone locally
  3. I build/update a static website on my laptop in that cloned repo
  4. I ‘push’ my website to my Reclaim site.
  5. Voila

So, not going through GitHub, just git between my laptop and my Reclaim web host, syncing it as needed.

Yes?

I do something similar but I round-trip everything through GitHub. So basically I update my Hugo site on my computer, push the changes to github, then I pull those changes from Github down to my shared hosting account. I have a script that does all of this in basically one step.

That being said, what you’ve asked about should be possible. I’ve never personally used this feature in cPanel, but cPanel does have the ability to host git repositories, so you can host a git repository directly on your account:

You’ll need your cPanel credentials when cloning the repo to your local computer, and those can be found here:

Awesome, Taylor. I’ll give it a whirl and report back… Thanks!

Hi, Taylor,

I got partway there but fell apart at authentication.

I’ve read the ssh keygen and ssh_access stuff, but I am confused about which end things are supposed to be happening at.

I think the way it’s supposed to work is I generate a key locally, then Import that to cPanel via the SSH Access tool, then authorize that.

Then I should be able to clone the (cPanel-hosted) repo, via a ssh URL (as it shows me in the tool).

Am I right about that stuff?

Also, is the git url here going to be my own domain, or is it the reclaim server that my domain is on?

Thanks again…

I believe the git url can be your own domain or the server domain becasue its working over SSH. I am able to SSH to my account with either.

For ssh key pair setup, I’d recommend checking out our guide here (specifically the “Generating a Public and Private Key Pair” section)

Then you should be able to use the ssh-copy-id command from your local computer to install the key on the server automatically like this:

ssh-copy-id CPANELUSERNAME@DOMAIN.COM

I am following this discussion with eager interest. I’m currently running a Jekyll-based site in GitHub pages, as well as a reveal.js site for my presentations, and would love not to be dependent on GitHub…

It could work for that too, given the caveat that you’ll need to use jekyll build to still build the site locally. Our shared hosting accounts don’t have the capability to run Ruby stuff. Ultimately I think this would be relatively minor though your workflow could be:

  1. write a blog post
  2. jekyll build
  3. commit and push your changes (including the built out website)

The only trick here is you’ll need to make sure permissions are good and the directory jekyll builds the site out to is set as your web root. Or maybe it might be easier to set up some kind of symlink or script to copy files to the web root. Again, I haven’t tested any of this yet, also I don’t currently use jekyll for any of my sites.

I do something similar for my blog with hugo except that in that case it does get built on the server, because hugo doesn’t have that ruby dependency. Hosting the actual repository in cPanel could be interesting, but I think at the moment at least, I enjoy Github’s web UI too much to give that piece up.

I am also following along this super interesting discussion too😎

I’m still struggling, Taylor, sorry.

I have the key generated, copied, etc.

What is ssh-copy-id supposed to do? When I run that it just says “no identities found.” Something’s missing here…

Thanks again,

I should add… with the key generated, and added/authorized to SSH Access in cPanel, I can successfully ssh to my Reclaim site. So maybe it works anyway?

Yeah sorry I don’t think I went into enough detail. The key is to be generated on your computer, and ssh-copy-id will set the key up for use on the server. That being said, if you are able to ssh into your account you should be set there.

Haha… we’re good.

This is actually functional now. I…

  • keygen’ed a new key
  • referenced that with my new site’s hostname in my .ssh/config file
  • Imported the public key to my cPanel SSH Access panel
  • and “Authorized” it

I could now ssh in, using

ssh://myid@mydomain/home/myidfolder/public_html

And then, using that same ssh URL, I found I could clone, push, and pull from git. And even from GitHub Desktop. Hooray!

So I can now build files locally, and sync them into my Reclaim site.

Off to learn 11ty now…

Thanks so much, Taylor!

3 Likes

Nice! 11ty looks neat but I’ve not played with it yet!

I hope you’ll keep posting about how this goes! I’m working on learning 11ty now as well.

Stay tuned, Kathleen… I began with the Itsiest, Bitsiest Eleventy Tutorial which suits my minimalist aesthetic very nicely. I now have built a blog that looks like 1995, and it’s all downhill (uphill?) from here. This is probably off-topic for here at this point, so I’ll keep you posted via Mastodon…

1 Like

Hi! I worked on this over the weekend. There’s a way to do it using git post-receive hooks, which should do exactly what you want it to do.

I tested it out and put some instructions here (generated using the same method). It’s based on existing tutorials for people doing the same thing on Dreamhost. Good luck!

1 Like

Thanks, Helen! It’s awesome to see this written down – especially the git setup, which is also where I “got stuck on this for SO LONG.” I especially appreciate where you’ve said “nb All the stuff in this section happens on your server, not your laptop” – that’s exactly where I get messed up every time :slight_smile:

The version of this I ended up with is a little simpler, because there is only one branch, and so no post-receive hooks… I have my local dev environment in a Sync.com (aka not Dropbox) folder on my laptop, so that gives me my backup, and so it’s just the static site that I push to Reclaim.

I am actively running this now, and am working towards announcing this publicly, but FWIW here’s Imaginary Text, in progress… Eleventy, pushed straight to Reclaim.

1 Like

Looks great! I love that minimalist style.

This topic was automatically closed after 365 days. New replies are no longer allowed.