Skip to content

Conversation

@zot
Copy link
Collaborator

@zot zot commented Feb 18, 2025

use GIT_ASKPASS to hide token from log messages

@zot zot requested a review from vdayanand February 18, 2025 21:49
@zot
Copy link
Collaborator Author

zot commented Feb 18, 2025

Tested this locally:

This should ask for a password and it does:

julia> run(`git clone https://github.com/zot/DemoRegistry`)
Cloning into 'DemoRegistry'...
fatal: cannot exec '/usr/bin/ksshaskpass': No such file or directory
Username for 'https://github.com': 

This does not ask for a password, runs properly, and does not log the token:

julia> u="https://zot:<TOKEN>@github.com/zot/DemoRegistry"
julia> runwithpasswd(u) do url, env; run(Cmd(`git clone $url`; env)); end
Cloning into 'DemoRegistry'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 19 (delta 0), reused 0 (delta 0), pack-reused 17 (from 1)
Receiving objects: 100% (19/19), done.
Resolving deltas: 100% (2/2), done.
Process(setenv(`git clone https://github.com/zot/DemoRegistry`,["GIT_ASKPASS=/tmp/jl_zNIlE8"]), ProcessExited(0))

add doc string for withpasswd function

bump version
@zot zot force-pushed the zot/git-ask-pass branch from 55338bc to 49944c7 Compare February 18, 2025 22:16
Copy link
Member

@vdayanand vdayanand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zot zot merged commit 4478448 into master Feb 20, 2025
5 checks passed
@zot zot deleted the zot/git-ask-pass branch February 20, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants