Answer the question
In order to leave comments, you need to log in
How to connect a dependent repository with a specific commit in Git?
Good afternoon.
It is necessary to implement control of the program configuration by means of GIT.
The program consists of 2 parts: binary files of the software version and text files of the configuration.
I want to connect binary files to configuration files as a dependent repository, but neither subtree nor submodules can refer to a specific assembly.
Perhaps there is some alternative solution? Was thinking about using a shell script to clone a git repo into a folder, but to change the version would have to tamper with the script each time. For storage I use GitLab, then environment variables, unfortunately, are not suitable.
Answer the question
In order to leave comments, you need to log in
but neither subtree nor submodules can refer to a specific assembly.
git submodule status
If anyone needs it in the future. Solved the problem using GitLab CI\CD.
Code on the example of the libgit2 repository.
You also need to add a check for changes in libgit2, otherwise pipline will crash with an error:
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
## compile – название процесса, потом увидим его в интерфейса
compile:
## stage – этап билда, по дефолтку их три: build, test, deploy.
## Для нас в данной ситуации это не критично
stage: build
## переходим к самому крипту
script:
- git clone https://your/repo.git --depth 1
- git clone https://github.com/libgit2/libgit2.git
- cd libgit2
- git checkout v1.0.0
- cd ..
- rm -r repo/libgit2
- mv libgit2 repo
- cd atm_custom
- git add --all
- git config --local --replace-all user.email "[email protected]"
- git config --local --replace-all user.name "Gitlab CI"
- git commit -m '[skip ci]Automated commit for CI'
- git push https://your/repo.git
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question