-
Notifications
You must be signed in to change notification settings - Fork 1
Disable interactive git credential prompts on fetch operations #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package git | ||
|
|
||
| import ( | ||
| "os/exec" | ||
|
|
||
| harnessgit "github.com/git-fire/git-harness/git" | ||
| ) | ||
|
|
||
| // PrepareNetworkGit configures cmd for fetch/push operations that may contact | ||
| // a remote. Delegates to git-harness so credential behavior stays aligned with git-fire. | ||
| func PrepareNetworkGit(cmd *exec.Cmd) { | ||
| harnessgit.PrepareNetworkGit(cmd) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package git | ||
|
|
||
| import ( | ||
| "os/exec" | ||
| "strings" | ||
| "testing" | ||
|
|
||
| testutil "github.com/git-fire/git-testkit" | ||
| ) | ||
|
|
||
| func TestFetchFailureReason_TerminalPromptsDisabled(t *testing.T) { | ||
| got := fetchFailureReason([]byte("fatal: could not read Username for 'https://github.com': terminal prompts disabled")) | ||
| want := "could not authenticate with remote — check your credentials and try again" | ||
| if got != want { | ||
| t.Fatalf("fetchFailureReason() = %q, want %q", got, want) | ||
| } | ||
| } | ||
|
|
||
| func TestNetworkFetch_UnauthenticatedHTTPSFailsWithoutPrompt(t *testing.T) { | ||
| repo := testutil.CreateTestRepo(t, testutil.RepoOptions{ | ||
| Name: "https-fetch-repo", | ||
| Remotes: map[string]string{ | ||
| "origin": "https://github.com/git-rain/nonexistent-repo-auth-test.git", | ||
| }, | ||
| }) | ||
|
|
||
| cmd := exec.Command("git", "fetch", "--all") | ||
| cmd.Dir = repo | ||
| PrepareNetworkGit(cmd) | ||
| output, err := cmd.CombinedOutput() | ||
| if err == nil { | ||
| t.Fatal("expected fetch to fail without credentials") | ||
| } | ||
| msg := strings.ToLower(string(output) + " " + err.Error()) | ||
| if !strings.Contains(msg, "terminal prompts disabled") && | ||
| !strings.Contains(msg, "could not read username") { | ||
| t.Fatalf("expected non-interactive auth failure, got output=%q err=%v", strings.TrimSpace(string(output)), err) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Homebrew gate expects Formula
High Severity
Stable release config now publishes
homebrew_casks(Cask underCasks/) instead ofbrews(Formula/git-rain.rb), but the release workflow still waits forFormula/git-rain.rbto update. GoReleaser can succeed while the Homebrew verify step times out and fails the release.Reviewed by Cursor Bugbot for commit 3983ecb. Configure here.