@@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "encoding/base64"
56 "fmt"
67 "io"
78 "io/ioutil"
@@ -122,6 +123,27 @@ func (h *GitopiaHandler) List(remote *core.Remote, forPush bool) ([]string, erro
122123
123124 out = append (out , fmt .Sprintf ("@refs/heads/%s HEAD" , h .remoteRepository .DefaultBranch ))
124125
126+ if _ , err := os .Stat (".lfsconfig" ); errors .Is (err , os .ErrNotExist ) {
127+ lfsURL := fmt .Sprintf ("%v/%v.git" , config .GitServerHost , h .remoteRepository .Id )
128+
129+ args := []string {
130+ "config" ,
131+ "--file=.lfsconfig" ,
132+ "lfs.url" ,
133+ lfsURL ,
134+ }
135+
136+ cmd , pipe := core .GitCommand ("git" , args ... )
137+ if err := cmd .Start (); err != nil {
138+ return nil , err
139+ }
140+ defer core .CleanUpProcessGroup (cmd )
141+
142+ if _ , err := io .Copy (ioutil .Discard , pipe ); err != nil {
143+ return nil , err
144+ }
145+ }
146+
125147 return out , nil
126148}
127149
@@ -232,9 +254,14 @@ func (h *GitopiaHandler) Push(remote *core.Remote, refsToPush []core.RefToPush)
232254 remote .Logger .Println ("Please sign the git server request on your ledger device." )
233255 }
234256
257+ credential := fmt .Sprintf ("%s:%s" , h .wallet .Address (), signature )
235258 args := []string {
236259 "-c" ,
237- fmt .Sprintf ("http.extraheader=Authorization: Bearer %s" , signature ),
260+ fmt .Sprintf ("http.extraheader=Authorization: Basic %s" , base64 .StdEncoding .EncodeToString ([]byte (credential ))),
261+ "-c" ,
262+ "credential.helper=" ,
263+ "-c" ,
264+ "credential.helper=gitopia" ,
238265 "push" ,
239266 remoteURL ,
240267 fmt .Sprintf ("%s:%s" , ref .Local , ref .Remote ),
0 commit comments