# Change path to git executable for Discourse Docker install

**URL:** <https://meta.discourse.org/t/change-path-to-git-executable-for-discourse-docker-install/189096>\
**Category:** Self-hosting\
**Created:** [May 4, 2021, 4:59am UTC](https://meta.discourse.org/t/change-path-to-git-executable-for-discourse-docker-install/189096 "2021-05-04T04:59:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![minyez](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minyez/32/219122_2.png) [@minyez](https://meta.discourse.org/u/minyez)\
**Post date:** [May 4, 2021, 4:59am UTC](https://meta.discourse.org/t/change-path-to-git-executable-for-discourse-docker-install/189096/1 "2021-05-04T04:59:17Z")

</div>

Hi all,

Thanks for the great forum app! Please forgive me as a newbie to both Docker and Discourse, if it is a trivial question. System: Ubuntu LTS 20.04

_Short_: is there any way to use git installed somewhere other than /usr/bin?

_Long_: I have manually installed a new version of git (2.31.1) in /usr/local (to get rid of link to libgnutls and the gnutls\_handshake() error) and have added /usr/local/bin to PATH. In the launcher, I added `echo $PATH && which git` before `cd /pups/` in `run_command`, and Running `./launcher rebuild app` gives

```plaintext
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin/:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
/usr/bin/git

```

Does this mean that all following git actions are actually using /usr/bin/git? In that case, I would rather expect git to be found at /usr/local/bin.

In fact, I do not remember installing git in /usr by apt-get or some other way. So I think it is associated to the way Docker works, is there any way to customize it?

Thanks again!  
minye

---

<div class="post-metadata">

**Author:** ![minyez](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/minyez/32/219122_2.png) [@minyez](https://meta.discourse.org/u/minyez)\
**Post date:** [May 7, 2021, 11:46am UTC](https://meta.discourse.org/t/change-path-to-git-executable-for-discourse-docker-install/189096/2 "2021-05-07T11:46:11Z")

</div>

Hi all,

For any one who happens to be here, I managed to do it by building a new image, tagged `newgit`, from the Discourse official base image, and then installing Discourse upon that by modifying the `image` variable in launcher.

The main instructions in the Dockerfile are as followed. All dependencies (perl, gcc, etc) are handled by the base image.

```dockerfile
# install a git free of gnutls
RUN cd / && \
    vcurl=7.68.0 && wget http://dl.uxnr.de/mirror/curl/curl-$vcurl.tar.gz && \
    vssl=1.1.1f && wget http://www.openssl.org/source/openssl-$vssl.tar.gz && \
    vgit=2.31.1 && wget http://mirrors.edge.kernel.org/pub/software/scm/git/git-$vgit.tar.gz && \
    tar -zxf curl-$vcurl.tar.gz && tar -zxf openssl-$vssl.tar.gz && \
    tar -zxf git-$vgit.tar.gz && \
    cd openssl-$vssl && ./config --prefix=/usr/local && make && make install && cd .. && \
    cd curl-$vcurl && ./configure --with-ssl=/usr/local --prefix=/usr/local --without-gnutls --disable-ldap --without-librtmp && make && make install && cd .. && \
    cd git-$vgit && make configure && ./configure --prefix=/usr/local --with-openssl=/usr/local --with-curl=/usr/local && make && make install && cd ../ && \
    rm -rf /curl-${vurl}* /openssl-${vssl}* /git-${vgit}*
# check git install
RUN which git && git version && (ldd -v /usr/local/libexec/git-core/git-remote-https | grep gnutls) || echo "Git is not linked to libgnutls"

```

and gives `/usr/local/bin/git`.

I am aware that this be a dirty hack and not recommended by the dev team. I put it here only as a reference from a Docker layman, in case that someone had a similar demand.
