Access private Git repositories using HTTP Basic authentication#127
Open
rdctmeconomou wants to merge 1 commit into
Open
Access private Git repositories using HTTP Basic authentication#127rdctmeconomou wants to merge 1 commit into
rdctmeconomou wants to merge 1 commit into
Conversation
This was adapted from docker-library#41.
Author
|
@Mazgis47, I would be grateful for your review, as well. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was adapted from #41.
Unfortunately, work on go-git/go-git#490 and go-git/go-git#491 has been abandoned, so I would like to propose adding HTTP Basic authentication support back into bashbrew. Compared to the original pull request, I corrected the imports, created missing environment variable mappings (
BASHBREW_GIT_USERNAMEandBASHBREW_GIT_PASSWORD), and patched code added since the original pull request.You can test this locally by setting
BASHBREW_GIT_USERNAMEto your GitHub username andBASHBREW_GIT_PASSWORDto an access token, e.g., the output of thegh auth tokencommand. I recommend against specifying any password/token on the command line given how visible that is to other unprivileged processes or to attackers with access to one's shell history.To test these changes in a GitHub Actions workflow:
GitRepoto that of the private repository created in step 1, and .github/workflows/ci.yaml (attached), altering the bashbrew fork reference on line 42 as needed. In the GitHub Actions configuration of the second repository, set the variablePRIVATE_REPOSITORY_ACCESS_APP_IDto the ID of the app created in step 2 and the secretPRIVATE_REPOSITORY_ACCESS_KEYto the app's private key.When the workflow runs, you should see in the output something similar to the following:
Note the private repository listed on the third line.
(The reference to the de-vri-es/setup-git-credentials action is unnecessary and only included to show the more customary Git credential store configuration.)