René's URL Explorer Experiment


Title: push_files leaves an orphan branch at the default branch's head when the push fails · Issue #3755 · github/github-mcp-server · GitHub

Open Graph Title: push_files leaves an orphan branch at the default branch's head when the push fails · Issue #3755 · github/github-mcp-server

X Title: push_files leaves an orphan branch at the default branch's head when the push fails · Issue #3755 · github/github-mcp-server

Description: Describe the bug When branch does not exist, push_files creates it from the default branch first (createReferenceFromDefaultBranch) and only then builds the tree and commit. If the tree or commit step fails, the new ref is not rolled bac...

Open Graph Description: Describe the bug When branch does not exist, push_files creates it from the default branch first (createReferenceFromDefaultBranch) and only then builds the tree and commit. If the tree or commit s...

X Description: Describe the bug When branch does not exist, push_files creates it from the default branch first (createReferenceFromDefaultBranch) and only then builds the tree and commit. If the tree or commit s...

Opengraph URL: https://github.com/github/github-mcp-server/issues/3755

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"push_files leaves an orphan branch at the default branch's head when the push fails","articleBody":"### Describe the bug\n\nWhen `branch` does not exist, `push_files` creates it from the default branch first (`createReferenceFromDefaultBranch`) and only then builds the tree and commit. If the tree or commit step fails, the new ref is not rolled back. The caller gets an error, but a branch pointing at the default branch's head stays behind. A retry then pushes onto that leftover branch, and it shows up in branch lists.\n\nWhen the branch already exists, the same failure leaves no partial commit, so only the new-branch path is affected.\n\nSilently creating a branch that doesn't exist is already raised as a question in #3473 (item 6). This issue is only about the ref left behind when the push then fails.\n\nCode (main 99d6d650, unchanged since v2.1.0): `pkg/github/repositories.go:1767-1772` (ref created when the branch is missing), `:1795-1800` (same for the empty-repo path), then `CreateTree` at `:1809` and `CreateCommit`/`UpdateRef` after it. Helper: `pkg/github/repositories_helper.go:75`. Open PR #3288 keeps the ensure-ref-first order (`ensurePushFilesBranchRef`), so it would not change this.\n\n### Affected version\n\nv2.1.0 (image `sha256:f6056fc1…0f8a`, commit 4bcdcdf8) and main nightly (image `sha256:48bc16d0…338f`, revision 99d6d650).\n\n### Steps to reproduce the behavior\n\n1. Make sure the branch `new-branch` does not exist.\n2. Call it with one valid file and one path that `CreateTree` rejects:\n   ```json\n   {\"name\":\"push_files\",\"arguments\":{\"owner\":\"OWNER\",\"repo\":\"REPO\",\"branch\":\"new-branch\",\"message\":\"push\",\"files\":[{\"path\":\"p4/ok.txt\",\"content\":\"ok\"},{\"path\":\".git/config\",\"content\":\"x\"}]}}\n   ```\n3. Result: `isError` with `failed to create tree: tree.path contains a malformed path component`.\n4. `GET /repos/OWNER/REPO/git/ref/heads/new-branch` returns 200, and the branch points at the default branch's head commit.\n\n### Expected vs actual behavior\n\nExpected: a failed push leaves the repository unchanged, with no new branch.\n\nActual: the error is returned and an orphan branch exists at the default branch's head.\n\nSuggested fix: tree and commit objects don't need a ref. Create the tree and the commit (parent = default branch head) first, then create the new ref directly at the new commit. Alternatively, delete the ref on any later failure.\n\n### Logs\n\n```\npush_files branch=new-branch -> ISERROR failed to create tree: tree.path contains a malformed path component\nGET git/ref/heads/new-branch -> 200, object.sha = faf1b251… (= default branch head)   [v2.1.0 and main]\n```\n\nFound during an independent audit of v2.1.0 on a throwaway org and private test repo. Prepared with AI assistance (Claude Code); reproduced by two independent test runs before filing.\n","author":{"url":"https://github.com/rafe-walker","@type":"Person","name":"rafe-walker"},"datePublished":"2026-11-09T05:53:56Z","url":"https://github.com/github/github-mcp-server/issues/3755"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6d77c8d8-4f11-c7fc-45e8-c9fe72599024
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCB4E:4265D:930EBE:C7C67C:6B05F003
html-safe-noncebf161a406fc30603ec8044c848b94e16e32c251bfb2420b94390adbc9a7f235d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjRFOjQyNjVEOjkzMEVCRTpDN0M2N0M6NkIwNUYwMDMiLCJ2aXNpdG9yX2lkIjoiMzM2MjM0MDUxMTI1MTAzNDExNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac266bdb9dd2acce4a57823ece51efd35a85686178561996a9de3995afd33950f3
hovercard-subject-tagissue:6280784303
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3755/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3bb44bac5d99814190338e404f90a73c7403a4b29f77db73cbc5deb64cb8af4d/github/github-mcp-server/issues/3755
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3bb44bac5d99814190338e404f90a73c7403a4b29f77db73cbc5deb64cb8af4d/github/github-mcp-server/issues/3755
og:image:altDescribe the bug When branch does not exist, push_files creates it from the default branch first (createReferenceFromDefaultBranch) and only then builds the tree and commit. If the tree or commit s...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamerafe-walker
hostnamegithub.com
expected-hostnamegithub.com
Nonec214754a6652274794ed4e054a7b71be999d69843f103ba54893001d45010ece
turbo-cache-controlno-preview
go-importgithub.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git
octolytics-dimension-user_id9919
octolytics-dimension-user_logingithub
octolytics-dimension-repository_id942771284
octolytics-dimension-repository_nwogithub/github-mcp-server
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id942771284
octolytics-dimension-repository_network_root_nwogithub/github-mcp-server
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7d164a4e71eb333b2b17fd5b17e18efb7855505c
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/github/github-mcp-server/issues/3755#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fissues%2F3755
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgithub%2Fgithub-mcp-server%2Fissues%2F3755
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=github%2Fgithub-mcp-server
Reloadhttps://github.com/github/github-mcp-server/issues/3755
Reloadhttps://github.com/github/github-mcp-server/issues/3755
Reloadhttps://github.com/github/github-mcp-server/issues/3755
githubhttps://github.com/github
github-mcp-serverhttps://github.com/github/github-mcp-server
Codehttps://github.com/github/github-mcp-server
Issues238 (238)https://github.com/github/github-mcp-server/issues
Pull requests226 (226)https://github.com/github/github-mcp-server/pulls
Discussionshttps://github.com/github/github-mcp-server/discussions
Actionshttps://github.com/github/github-mcp-server/actions
Security and quality2 (2)https://github.com/github/github-mcp-server/security
Insightshttps://github.com/github/github-mcp-server/insights
https://github.com/github/github-mcp-server
New issuehttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3755
New issuehttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3755
#3778https://github.com/github/github-mcp-server/pull/3778
push_files leaves an orphan branch at the default branch's head when the push failshttps://github.com/github/github-mcp-server/issues/3755#top
#3778https://github.com/github/github-mcp-server/pull/3778
https://github.com/rafe-walker
rafe-walkerhttps://github.com/rafe-walker
on Nov 9, 2026https://github.com/github/github-mcp-server/issues/3755#issue-6280784303
#3473https://github.com/github/github-mcp-server/issues/3473
99d6d65https://github.com/github/github-mcp-server/commit/99d6d6503a7b2a133e2f8a595d6d0ba24b4086d3
#3288https://github.com/github/github-mcp-server/pull/3288
4bcdcdfhttps://github.com/github/github-mcp-server/commit/4bcdcdf8d7beee98c9448e73e257308280924cc4
99d6d65https://github.com/github/github-mcp-server/commit/99d6d6503a7b2a133e2f8a595d6d0ba24b4086d3
https://github.com/rafe-walker
rafe-walkerhttps://github.com/rafe-walker
on Nov 12, 2026https://github.com/github/github-mcp-server/issues/3755#issuecomment-6829108533
#3778https://github.com/github/github-mcp-server/pull/3778
eejdhttps://github.com/eejd
on Nov 22, 2026https://github.com/github/github-mcp-server/issues/3755#event-36929710108
fix(github#3755): only roll back created branch while it still points…https://github.com/eejd/go-github-mcp-server/commit/4348b2bca26e5a1d5041c71d1b7801a2a842a04c
github#3755https://github.com/github/github-mcp-server/issues/3755
4348b2bhttps://github.com/eejd/go-github-mcp-server/commit/4348b2bca26e5a1d5041c71d1b7801a2a842a04c
fix(github#3755): only roll back created branch while it still points…https://github.com/eejd/go-github-mcp-server/commit/f75d054486f9378aa8ed9d8ddc90dacec22fa198
github#3755https://github.com/github/github-mcp-server/issues/3755
f75d054https://github.com/eejd/go-github-mcp-server/commit/f75d054486f9378aa8ed9d8ddc90dacec22fa198
fix(github#3755): compare-and-delete rollback and report left-in-plac…https://github.com/eejd/go-github-mcp-server/commit/28d8756c59df901324a677a774a06740d9bfd9c9
github#3755https://github.com/github/github-mcp-server/issues/3755
28d8756https://github.com/eejd/go-github-mcp-server/commit/28d8756c59df901324a677a774a06740d9bfd9c9
fix(github#3755): compare-and-delete rollback and report left-in-plac…https://github.com/eejd/go-github-mcp-server/commit/0cdf5268f34d80f3254a9de2353faf4ea766fb99
github#3755https://github.com/github/github-mcp-server/issues/3755
0cdf526https://github.com/eejd/go-github-mcp-server/commit/0cdf5268f34d80f3254a9de2353faf4ea766fb99
Sign up for freehttps://github.com/signup?return_to=https://github.com/github/github-mcp-server/issues/3755
Sign in to commenthttps://github.com/login?return_to=https://github.com/github/github-mcp-server/issues/3755
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.