| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| @@ -0,0 +1,74 @@ | |||
| #include "ansi_code.hpp" | |||
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).
Sorry, something went wrong.
| class cursor_hider : noncopyable_nonmovable | ||
| { | ||
| public: | ||
| cursor_hider(bool hide = true); |
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.
Sorry, something went wrong.
|
This works fine locally, but the multiline input to the subprocess.run calls is not happy in CI for some reason. |
Sorry, something went wrong.
|
Closing this to resubmit it from this repo rather than my fork, so that it has access to the repository secrets. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR adds support for entering and using credentials (username and password) to authenticate https requests to allow git clone, git fetch and git push to 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.mp4This uses the private git2cpp-test-private repository, 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 each clone, fetch or push subcommand.
Most of the new functionality here is in the new user_credentials function that is a libgit2 callback 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 follows libgit2 standard practice but calling our own input_prompt function.
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 the git2cpp-test-private repo 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 via
This env var could be set permanently in your bash_profile or 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_TOKEN as a repository secret so that CI can run all the tests.