Installation of git on Libreelec

  • Hi,

    I am running Libreelec on...

    raspberry pi 2

    8.02

    I have spent some time searching for this possibility but no joy, "git" is just too common search term.

    Is it possible to get git running on Libreelec ether via a addon or perhaps directly via a binary?

    I'm not currently using docker, so would prefer not to go down that route.

    Thanks

  • Ok thanks again chewit,

    This is what I came up with, if anybody else is in need of git

    Based on alpine/git currently on the docker hub (https://hub.docker.com/r/alpine/git/)

    and should work for arm32v6 and arm32v7 architecture

    First make a dir to build the app

    cd ~/

    mkdir gitapp 

    cd gitapp

    Then create a docker build file

    nano Dockerfile

    Paste the following

    Use docker to build the git app

    docker build .

    This will build the docker container

    when it has finished building, the last line of the output should read...

    "Successfully built" followed by a number. take note of that nunber

    Now add a function to the .profile/.bashrc located in the home dir.

    this will be called every time git is called in the command line.

    cd ~/

    nano .profile

    Paste the following replacing the ??? with the number outputed in the build process

    Code
    function git () {
    (docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git ?????????? "$@")
    }

    Now reload the current user profile by loging out and back in or...

    source ~/.profile

    That should be it!

    try running a git command from terminal

    git help

    If all is well the temp dir we created to build the app can be removed

    rm -r ~/gitapp

    regards

  • This is brilliant! Thank you. Question tho, how can I add this to the PATH so a docker build can call it?]

    Nevermind, I just cloned the repo using this and built from local directory.

  • Hi,

    I've recently moved my rpi distro to LibreELEC; I also used to have git on that device, as I use it as a centralisation point for some repositories. I know this is out of scope for LibreELEC, but still, I want to see if I can still have that. So I managed to install the git CLI with the help of the above instructions thanks for that! <3 ) and also this, but for some reason, when I create a git bare repo on the pi, it isn't recognized as I would expect. Do you know if it's a limitation, maybe due to running as root?

    Code
    mkdir repo.git && cd repo.git
    git init --bare

    Then testing it:

    Code
    $ cd ..
    $ git clone repo.git
    fatal: repository 'repo.git' does not exist

    On another system (not LibreELEC), the same steps would work.

    Something weird when doing "git init --bare" is, in the output, it writes "Initialized empty Git repository in /git/"

    Which is obviously wrong, there's no /git, and I do see created git files in my ~/repo.git

    Any idea what I could try?