mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 23:14:43 +00:00
Add ssh key authentication when cloning via ssh
This commit is contained in:
@@ -16,6 +16,8 @@ const (
|
||||
DefReposRoot = "repositories"
|
||||
KeyDefaultHost = "defaultHost"
|
||||
DefDefaultHost = "github.com"
|
||||
KeyPrivateKey = "privateKey"
|
||||
DefPrivateKey = "id_rsa"
|
||||
)
|
||||
|
||||
// gitconfig provides methods for looking up configiration values inside .gitconfig file
|
||||
@@ -56,6 +58,10 @@ func setMissingValues(cfg *gitconfig) {
|
||||
if isUnsetOrEmpty(KeyDefaultHost) {
|
||||
viper.Set(KeyDefaultHost, cfg.get(KeyDefaultHost, DefDefaultHost))
|
||||
}
|
||||
|
||||
if isUnsetOrEmpty(KeyPrivateKey) {
|
||||
viper.Set(KeyPrivateKey, cfg.get(KeyPrivateKey, path.Join(home(), ".ssh", DefPrivateKey)))
|
||||
}
|
||||
}
|
||||
|
||||
// get looks up the value for a given key in gitconfig file.
|
||||
|
||||
Reference in New Issue
Block a user