@@ -123,12 +123,13 @@ data GitSource = GitSource
123 deriving (Show, Eq, Ord)
123 deriving (Show, Eq, Ord)
125-- | Convert a GitHub source to a regular Git source. Assumes no submodules.
125-- | Convert a GitHub source to a regular Git source. Assumes no submodules.
126−forgetGithub :: GitHubSource -> GitSource
126+forgetGithub :: Bool -> GitHubSource -> GitSource
127−forgetGithub s = GitSource
127+forgetGithub useSsh s = GitSource
128 { _gitSource_url = URI
128 { _gitSource_url = URI
129− { uriScheme = Just $ fromRight' $ mkScheme "https"
129+ { uriScheme = Just $ fromRight' $ mkScheme $ if useSsh then "ssh" else "https"
130 , uriAuthority = Right $ Authority
130 , uriAuthority = Right $ Authority
131− { authUserInfo = Nothing
131+ { authUserInfo = UserInfo (fromRight' $ mkUsername "git") Nothing
132 , authHost = fromRight' $ mkHost "github.com"
133 , authHost = fromRight' $ mkHost "github.com"
133 , authPort = Nothing
134 , authPort = Nothing
@@ -573,7 +574,7 @@ unpackThunk' noTrail thunkDir = readThunk thunkDir >>= \case
573 withTempDirectory thunkParent thunkName $ \tmpRepo -> do
574 withTempDirectory thunkParent thunkName $ \tmpRepo -> do
574 let obGitDir = tmpRepo </> ".git" </> "obelisk"
575 let obGitDir = tmpRepo </> ".git" </> "obelisk"
575 s = case _thunkPtr_source tptr of
576 s = case _thunkPtr_source tptr of
576− ThunkSource_GitHub s' -> forgetGithub s'
577+ ThunkSource_GitHub s' -> forgetGithub False s'
577 ThunkSource_Git s' -> s'
578 ThunkSource_Git s' -> s'
578 withSpinner' ("Fetching thunk " <> T.pack thunkName)
579 withSpinner' ("Fetching thunk " <> T.pack thunkName)
579 (finalMsg noTrail $ const $ "Fetched thunk " <> T.pack thunkName) $ do
580 (finalMsg noTrail $ const $ "Fetched thunk " <> T.pack thunkName) $ do
@@ -727,7 +728,7 @@ getThunkPtr' checkClean thunkDir = do
727getLatestRev :: MonadObelisk m => ThunkSource -> m ThunkRev
728getLatestRev :: MonadObelisk m => ThunkSource -> m ThunkRev
728getLatestRev os = do
729getLatestRev os = do
729 let gitS = case os of
730 let gitS = case os of
730− ThunkSource_GitHub s -> forgetGithub s
731+ ThunkSource_GitHub s -> forgetGithub False s
731 ThunkSource_Git s -> s
732 ThunkSource_Git s -> s
732 (_, commit) <- gitGetCommitBranch (_gitSource_url gitS) (untagName <$> _gitSource_branch gitS)
733 (_, commit) <- gitGetCommitBranch (_gitSource_url gitS) (untagName <$> _gitSource_branch gitS)
733 case os of
734 case os of
@@ -749,11 +750,11 @@ uriThunkPtr uri mbranch = do
749 case rev of
750 case rev of
750 Right r -> pure (ThunkSource_GitHub s, r)
751 Right r -> pure (ThunkSource_GitHub s, r)
751 Left e -> do
752 Left e -> do
752− putLog Warning $ " \
753+ putLog Warning $ "\
753\Failed to fetch archive from GitHub. This is probably a private repo. \
754\Failed to fetch archive from GitHub. This is probably a private repo. \
754\Falling back on normal fetchgit. Original failure:\n\n"
755\Falling back on normal fetchgit. Original failure:\n\n"
755 errorToWarning e
756 errorToWarning e
756− let s' = forgetGithub s
757+ let s' = forgetGithub True s
757 (,) (ThunkSource_Git s') <$> gitThunkRev s' commit
758 (,) (ThunkSource_Git s') <$> gitThunkRev s' commit
758 ThunkSource_Git s -> (,) (ThunkSource_Git s) <$> gitThunkRev s commit
759 ThunkSource_Git s -> (,) (ThunkSource_Git s) <$> gitThunkRev s commit
759 pure $ ThunkPtr
760 pure $ ThunkPtr