@@ -69,7 +69,7 @@ func (h *GitopiaHandler) Initialize(remote *core.Remote) error {
6969 }
7070
7171 gitServerHost , _ := config .GitConfigGet (config .GitopiaConfigGitServerHostOption )
72- if gitServerHost == "" {
72+ if gitServerHost == "" || ! api . CheckGitServerHostLiveness ( gitServerHost ) {
7373 gitServerHost = api .GetBestGitServerHost (grpcHost )
7474 if gitServerHost != "" {
7575 if err := api .SetConfiguredGitServerHost (gitServerHost ); err != nil {
@@ -148,9 +148,9 @@ func (h *GitopiaHandler) List(remote *core.Remote, forPush bool) ([]string, erro
148148}
149149
150150func (h * GitopiaHandler ) Fetch (remote * core.Remote , refsToFetch []core.RefToFetch ) error {
151- gitServerHost , _ := config .GitConfigGet (config .GitopiaConfigGitServerHostOption )
152- if gitServerHost == "" {
153- gitServerHost = config . GitServerHost
151+ gitServerHost , err := config .GitConfigGet (config .GitopiaConfigGitServerHostOption )
152+ if err != nil {
153+ return err
154154 }
155155 remoteURL := fmt .Sprintf ("%v/%v.git" , gitServerHost , h .remoteRepository .Id )
156156
@@ -228,9 +228,9 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush)
228228 return nil , fmt .Errorf ("fatal: you don't have write permissions to this repository" )
229229 }
230230
231- gitServerHost , _ := config .GitConfigGet (config .GitopiaConfigGitServerHostOption )
232- if gitServerHost == "" {
233- gitServerHost = config . GitServerHost
231+ gitServerHost , err := config .GitConfigGet (config .GitopiaConfigGitServerHostOption )
232+ if err != nil {
233+ return nil , err
234234 }
235235 remoteURL := fmt .Sprintf ("%v/%v.git" , gitServerHost , h .remoteRepository .Id )
236236
0 commit comments