Skip to content

Cloning with git

Jake Deery edited this page May 31, 2023 · 2 revisions

To clone a Git repository, you need to install git first and foremost. Assuming you are on a Debian system, start by running:

sudo apt update ; sudo apt install git -y

This will tell Debian to go away, fetch the latest list of applications, and then install git from that list. As git is included in the Debian repositories, it should install first time on either Debian or Ubuntu.

Now git is installed, we can begin to download source code repositories. As git is decentralised, you can download read-only copies of any source code project that is publicly available. Always check the licence's rules on modifying and distributing the source code afterwards.

To clone Koha, you can try doing (for 22.11):

git clone --filter=blob:none --branch=22.11.x https://gitlab.com/koha-community/Koha.git ./kohaclone

To explain what we just did, let me break down the line above:

  • git is the executable, which we downloaded earlier with apt
  • clone tells git we want to download some source code from a remote location (i.e. over the web)
  • --filter=blob:none tells git to download only the refs, not the actual data (this gets fetched on the fly)
  • --branch=xxx tells git we don't want the main code, but a 'branch' of it, which in this case, is the current stable Koha version
  • https://gitlab.com/koha-community/Koha.git is the remote source code location. In git, we call this the origin.
  • ./kohaclone tells git to download the code into a folder, kohaclone. Depending on where you are currently cd'd to, this will be in the present working directory (pwd)

That's a very, very brief overview of git! If you want to know more, I'd recommend the git-scm reference manual

Good hunting!

Clone this wiki locally