I have a Docker image, which should pull the repo from git repository (hint about the token is taken from pretty similar question)
If i use in Dockerfile
RUN git clone https://TOKEN@github.com/company/project.git /folder
Then it works fine.
If i try to put cloning process into the separate file: Dockerfile:
CMD [ "/update.sh" ]
update.sh:
if [ -f /folder/.git ]; then
git clone https://TOKEN@github.com/company/project.git /folder
else
git -C /folder pull
fi
then i receive a very strange error:
fatal: Not a git repository (or any of the parent directories): .git
All answers that my google-fu was able to found was about "i'm receiving fatal: Not a git repository when running git pull" - which makes sense if you're pulling from the wrong directory. But in my case, git clone produces the "fatal: Not a git repository" error, which is super confusing.