Add support for entering user credentials to access remote private repos#104
Open
ianthomas23 wants to merge 1 commit intoQuantStack:mainfrom
Open
Add support for entering user credentials to access remote private repos#104ianthomas23 wants to merge 1 commit intoQuantStack:mainfrom
ianthomas23 wants to merge 1 commit intoQuantStack:mainfrom
Conversation
ianthomas23
commented
Feb 23, 2026
| @@ -0,0 +1,74 @@ | |||
| #include "ansi_code.hpp" | |||
Member
Author
There was a problem hiding this comment.
I have renamed this from output.cpp to input_output.cpp as it is now a mixture of input and output functions and scope classes (and the header file too).
ianthomas23
commented
Feb 23, 2026
| class cursor_hider : noncopyable_nonmovable | ||
| { | ||
| public: | ||
| cursor_hider(bool hide = true); |
Member
Author
There was a problem hiding this comment.
This allows nested scope objects to disable the cursor when doing a long git clone, but re-enable it for the username and password entry.
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 PR adds support for entering and using credentials (username and password) to authenticate
httpsrequests to allowgit clone,git fetchandgit pushto remote private repositories on github. This only works for linux and macos builds, the wasm build will be done separately. Screencast of this in action:credentials.mp4
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 normalgit. 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_credentialsfunction that is alibgit2callback 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.