Add support for entering user credentials to access remote private repos#116
Open
ianthomas23 wants to merge 4 commits intomainfrom
Open
Add support for entering user credentials to access remote private repos#116ianthomas23 wants to merge 4 commits intomainfrom
ianthomas23 wants to merge 4 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #116 +/- ##
==========================================
+ Coverage 86.83% 87.25% +0.42%
==========================================
Files 60 60
Lines 2340 2378 +38
Branches 275 282 +7
==========================================
+ Hits 2032 2075 +43
+ Misses 308 303 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
OK, this is good to go now. Once this is merged, any PRs submitted from this repo will have access to the secret and will all of the remote tests. PRs submitted from forks of this repo will not have access to the secret and those tests will be skipped. |
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 is PR #104 resubmitted from a branch on this upstream repo rather than a branch on my fork, so that it has access to the secrets defined here. Comments from previous PR reproduced (see that PR for screencast):
This PR adds support for entering and using credentials (username and password) to authenticate https requests to allow
git clone,git fetchandgit pushto remote private repositories on github. This only works for linux and macos builds, the wasm build will be done separately.This uses the private
git2cpp-test-privaterepository, and authentication is performed using a fine-grained github Personal Access Token (PAT) which I paste into the terminal. Note that the PAT is not echoed to screen so that it cannot be seen by others, which is the same behaviour that occurs with normal git. Credentiials are not stored or cached at all at this stage, so have to be entered separately for eachclone,fetchorpushsubcommand.Most of the new functionality here is in the new user_credentials function that is a
libgit2callback to prompt the user for a username and password. Actually using a PAT means that the username is ignored, but it may not be ignored for other remotes than github. The format of the callback function followslibgit2standard practice but calling our owninput_promptfunction.The new tests use an environment variable
GIT2CPP_TEST_PRIVATE_TOKEN. If this is not present then the relevant tests are skipped, if it is present those tests are run. This env var needs to be a fine-grained PAT for thegit2cpp-test-privaterepo with appropriate read and write permissions - I will pass one the token to other maintainers here via private messages. Once you have it locally you can run the tests using it viaThis env var could be set permanently in your
bash_profileor similar, which isn't very secure as all other processes on your computer will be able to read it, but since it only allows access to a specific github repo used for test purposes only this cannot do much damage. The token expires in one year.I have added
GIT2CPP_TEST_PRIVATE_TOKENas a repository secret so that CI can run all the tests.