Browse Source

Set GIT_SSH_COMMAND='ssh -o "BatchMode yes"' to block prompts when using SSH auth.

pull/203/head
Fredrik Ekre 4 years ago
parent
commit
063f6540dc
  1. 5
      CHANGELOG.md
  2. 6
      src/Literate.jl

5
CHANGELOG.md

@ -8,7 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 @@ -8,7 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Update remote HEAD branch detection to use `addenv` instead of `setenv` such that e.g.
ssh-agent variables are still available to the git command. ([#197][github-197])
ssh-agent variables are available to the git command. Also set
`GIT_SSH_COMMAND='ssh -o "BatchMode yes"'` to supress prompts when using ssh.
([#197][github-197])
## [2.13.2] - 2022-04-22
### Fixed

6
src/Literate.jl

@ -270,8 +270,12 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing) @@ -270,8 +270,12 @@ function create_configuration(inputfile; user_config, user_kwargs, type=nothing)
fallback_edit_commit = "master"
if (git = Sys.which("git"); git !== nothing)
try
env = copy(ENV)
# Set environment variables to block interactive prompt
env["GIT_TERMINAL_PROMPT"] = "0"
env["GIT_SSH_COMMAND"] = get(ENV, "GIT_SSH_COMMAND", "ssh -o \"BatchMode yes\"")
str = read(pipeline(ignorestatus(
addenv(`$(git) remote show origin`, ["GIT_TERMINAL_PROMPT=0"]; dir=dirname(inputfile))
setenv(`$(git) remote show origin`, env; dir=dirname(inputfile))
), stderr=devnull), String)
if (m = match(r"^\s*HEAD branch:\s*(.*)$"m, str); m !== nothing)
fallback_edit_commit = String(m[1])

Loading…
Cancel
Save