Publishing with git + ssh: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
(avoid language like "of course")
Line 1: Line 1:
This recipe is to describe the steps for taking a local folder that's managed by git and using a remote server where you have ssh access, creating an "as-simple-as-possible" remote that can be pushed to (and eventually pulled from) and that is also mirrored on the same server. In other words, there's also a public working directory that automatically gets updated (via a githook) when the repo is pushed to. '''This recipe does not require that you use a git server like gitea, gitlab, or github. Just that you have ssh access to a server.''' You can of course combine this with also using a git server (as git repos can have multiple remotes).
This recipe is to describe the steps for taking a local folder that's managed by git and using a remote server where you have ssh access, creating an "as-simple-as-possible" remote that can be pushed to (and eventually pulled from) and that is also mirrored on the same server. In other words, there's also a public working directory that automatically gets updated (via a githook) when the repo is pushed to. '''This recipe does not require that you use a git server like gitea, gitlab, or github. Just that you have ssh access to a server.''' You can combine this with also using a git server (as git repos can have multiple remotes).


The steps
The steps

Revision as of 15:50, 9 October 2024

This recipe is to describe the steps for taking a local folder that's managed by git and using a remote server where you have ssh access, creating an "as-simple-as-possible" remote that can be pushed to (and eventually pulled from) and that is also mirrored on the same server. In other words, there's also a public working directory that automatically gets updated (via a githook) when the repo is pushed to. This recipe does not require that you use a git server like gitea, gitlab, or github. Just that you have ssh access to a server. You can combine this with also using a git server (as git repos can have multiple remotes).

The steps

  • Convert local folder into a bare repo
  • scp the bare repo to a (non-public) part of your server
  • Create the webhook in the bare repo on the server

Convert local folder into a bare repo

   git clone --bare project project.git

Converts normal folder project (that is already git-managed!), into a bare repository project.git.

scp the bare repo to your server

Here assuming you have a folder called git in your remote home folder.

   scp -r project.git remote:git/