diff --git a/cmd/agola/cmd/remotesourcecreate.go b/cmd/agola/cmd/remotesourcecreate.go index d18e3bb..f68f0fc 100644 --- a/cmd/agola/cmd/remotesourcecreate.go +++ b/cmd/agola/cmd/remotesourcecreate.go @@ -83,10 +83,16 @@ func init() { func remoteSourceCreate(cmd *cobra.Command, args []string) error { gwclient := gwclient.NewClient(gatewayURL, token) + flags := cmd.Flags() + // for github remote source type, set defaults for github.com if remoteSourceCreateOpts.rsType == "github" { - remoteSourceCreateOpts.apiURL = github.GitHubAPIURL - remoteSourceCreateOpts.sshHostKey = github.GitHubSSHHostKey + if !flags.Changed("api-url") { + remoteSourceCreateOpts.apiURL = github.GitHubAPIURL + } + if remoteSourceCreateOpts.apiURL == github.GitHubAPIURL && !flags.Changed("ssh-host-key") { + remoteSourceCreateOpts.sshHostKey = github.GitHubSSHHostKey + } } if remoteSourceCreateOpts.apiURL == "" {