Last active
February 1, 2022 08:38
-
-
Save asgrim/05d2dfe7ad802d88993c9f990d65d4c7 to your computer and use it in GitHub Desktop.
GitLab checkout process - example of how to replicate a git checkout that GitLab does (more or less)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir project-checkout | |
cd project-checkout | |
# https://gitlab.com/gitlab-org/gitlab-runner/-/blob/b41ed180/shells/abstract.go#L353 | |
git init | |
# https://gitlab.com/gitlab-org/gitlab-runner/-/blob/b41ed180/shells/abstract.go#L357 | |
git remote add origin <remote_url> | |
# https://gitlab.com/gitlab-org/gitlab-runner/-/blob/b41ed180/shells/abstract.go#L366 | |
# build.GitInfo.Refspecs is defined: https://gitlab.com/gitlab-org/gitlab-runner/-/blob/9d8d6f93/common/support.go#L58 | |
git fetch origin +refs/heads/*:refs/origin/heads/* +refs/tags/*:refs/tags/* | |
# https://gitlab.com/gitlab-org/gitlab-runner/-/blob/b41ed180/shells/abstract.go#L402 | |
git checkout -f <commit_sha_of_the_build> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment