Repository navigation
fix(config): add new hosts before a matching wildcard block - #126
Open
lord-helicon wants to merge 1 commit into
Open
lord-helicon wants to merge 1 commit into
lord-helicon wants to merge 1 commit into
Conversation
New hosts were appended to the end of the file, after a trailing "Host *". OpenSSH uses the first value it finds for each option, so anything set under "Host *" (User, IdentityFile, ...) silently overrode the same option on the new host. Insert the new host before the first non-global Host block whose patterns match its alias.
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.
New hosts were appended at the end of
~/.ssh/config, after a trailingHost *. OpenSSH uses the first value it finds for each option, so anything set underHost *(User,IdentityFile, …) silently overrode the same option on hosts added through lazyssh.For example, with this config:
ssh -G bresolvesuser wildcard. After this change the new host is written beforeHost *, andssh -G bresolvesuser me.New hosts are now inserted before the first
Hostblock whose patterns match the new alias, such asHost *orHost lab-*when addinglab-3. Global settings at the top of the file (Include, options before the firstHost) stay where they are. If nothing matches, the host is appended as before.Testing
TestAddServerInsertsBeforeMatchingWildcardcovers a trailingHost *with globalIncludelines and a matching pattern (lab-*). It compares the full file contents.make build(gofumpt, vet, golangci-lint) andmake testpass.This PR is independent of my other two config fixes. The small
helpers_test.gois identical in all three, so they merge cleanly in any order.