Package org.eclipse.jgit.transport
Class OpenSshConfig
- java.lang.Object
-
- org.eclipse.jgit.transport.OpenSshConfig
-
- All Implemented Interfaces:
com.jcraft.jsch.ConfigRepository
public class OpenSshConfig extends java.lang.Object implements com.jcraft.jsch.ConfigRepositoryFairly complete configuration parser for the OpenSSH ~/.ssh/config file.JSch does have its own config file parser
OpenSSHConfigsince version 0.1.50, but it has a number of problems:- it splits lines of the format "keyword = value" wrongly: you'd end up with the value "= value".
- its "Host" keyword is not case insensitive.
- it doesn't handle quoted values.
- JSch's OpenSSHConfig doesn't monitor for config file changes.
This parser makes the critical options available to
SshSessionFactoryviaOpenSshConfig.Hostobjects returned bylookup(String), and implements a fully conformingConfigRepositoryprovidingConfigRepository.Configs viagetConfig(String).- See Also:
OpenSshConfigFile
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpenSshConfig.HostConfiguration of one "Host" block in the configuration file.
-
Field Summary
Fields Modifier and Type Field Description private OpenSshConfigFileconfigFileThe base file.
-
Constructor Summary
Constructors Constructor Description OpenSshConfig(java.io.File h, java.io.File cfg)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OpenSshConfigget(FS fs)Obtain the user's configuration data.com.jcraft.jsch.ConfigRepository.ConfiggetConfig(java.lang.String hostName)OpenSshConfig.Hostlookup(java.lang.String hostName)Locate the configuration for a specific host request.java.lang.StringtoString()
-
-
-
Field Detail
-
configFile
private OpenSshConfigFile configFile
The base file.
-
-
Method Detail
-
get
public static OpenSshConfig get(FS fs)
Obtain the user's configuration data.The configuration file is always returned to the caller, even if no file exists in the user's home directory at the time the call was made. Lookup requests are cached and are automatically updated if the user modifies the configuration file since the last time it was cached.
- Parameters:
fs- the file system abstraction which will be necessary to perform certain file system operations.- Returns:
- a caching reader of the user's configuration file.
-
lookup
public OpenSshConfig.Host lookup(java.lang.String hostName)
Locate the configuration for a specific host request.- Parameters:
hostName- the name the user has supplied to the SSH tool. This may be a real host name, or it may just be a "Host" block in the configuration file.- Returns:
- r configuration for the requested name. Never null.
-
getConfig
public com.jcraft.jsch.ConfigRepository.Config getConfig(java.lang.String hostName)
Retrieves the full
Configfor the given host name. Should be called only by Jsch and tests.- Specified by:
getConfigin interfacecom.jcraft.jsch.ConfigRepository- Since:
- 4.9
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-