Skip to content

Commit 3de91dc

Browse files
authored
[easy][global] global push/pull should not require login for github (#1609)
## Summary Login should not be required for push/pull to github. Fixes #1580 ## How was it tested? ``` devbox global push git@github.com:mikeland73/global.git devbox global pull git@github.com:mikeland73/global.git ```
1 parent 796168b commit 3de91dc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

internal/boxcli/pull.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"go.jetpack.io/devbox/internal/goutil"
1818
"go.jetpack.io/devbox/internal/impl/devopt"
1919
"go.jetpack.io/devbox/internal/pullbox/s3"
20+
"go.jetpack.io/pkg/sandbox/auth"
2021
)
2122

2223
type pullCmdFlags struct {
@@ -63,9 +64,9 @@ func pullCmdFunc(cmd *cobra.Command, url string, flags *pullCmdFlags) error {
6364

6465
var creds devopt.Credentials
6566
t, err := genSession(cmd.Context())
66-
if err != nil {
67+
if err != nil && !errors.Is(err, auth.ErrNotLoggedIn) {
6768
return errors.WithStack(err)
68-
} else if t != nil {
69+
} else if t != nil && err == nil {
6970
creds = devopt.Credentials{
7071
IDToken: t.IDToken,
7172
Email: t.IDClaims().Email,

internal/boxcli/push.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package boxcli
66
import (
77
"github.com/pkg/errors"
88
"github.com/spf13/cobra"
9+
"go.jetpack.io/pkg/sandbox/auth"
910

1011
"go.jetpack.io/devbox"
1112
"go.jetpack.io/devbox/internal/goutil"
@@ -43,9 +44,9 @@ func pushCmdFunc(cmd *cobra.Command, url string, flags pushCmdFlags) error {
4344
}
4445
t, err := genSession(cmd.Context())
4546
var creds devopt.Credentials
46-
if err != nil {
47+
if err != nil && !errors.Is(err, auth.ErrNotLoggedIn) {
4748
return errors.WithStack(err)
48-
} else if t != nil {
49+
} else if t != nil && err == nil {
4950
creds = devopt.Credentials{
5051
IDToken: t.IDToken,
5152
Email: t.IDClaims().Email,

0 commit comments

Comments
 (0)