You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
get_file_contents is not working properly (Path did not point to a file or directory, but resolved git ref) #864
GitHub MCP Server
Version: v0.10.0
Commit: 45e90ae
Build Date: 2025-08-01T14:36:17Z
Steps to reproduce the behavior
Type "Read file X in repo Y"
Expected vs actual behavior
File should be correctly retrieved from the Github.
Logs
⏺ I found the file localenv.config.yaml. Let me read its contents:
⏺ github_twdcgrid - Get file or directory contents (MCP)(owner: "COST", repo: "baymax", path: "localenv.config.yaml")
⎿ Path did not point to a file or directory, but resolved git ref to {"Ref":"refs/heads/main","SHA":"b32ec16443d8f6fef6ba16913d33f0abfc3aa02d"} with possible path matches: ["
localenv.config.yaml"]
⎿ Interrupted by user
> supply "Ref":"refs/heads/main"
✻ Thinking…
The user wants me to supply the ref parameter with "refs/heads/main" when making the request to get the file contents.
⏺ github_twdcgrid - Get file or directory contents (MCP)(owner: "COST", repo: "baymax", path: "localenv.config.yaml", ref: "refs/heads/main")
⎿ Path did not point to a file or directory, but resolved git ref to {"Ref":"refs/heads/main","SHA":"b32ec16443d8f6fef6ba16913d33f0abfc3aa02d"} with possible path matches: ["
localenv.config.yaml"]
⎿ Interrupted by user
> supply sha as well
✻ Thinking…
The user wants me to supply the SHA as well when making the request. Let me use the SHA that was returned in the previous response.
⏺ github_twdcgrid - Get file or directory contents (MCP)(owner: "COST", repo: "baymax", path: "localenv.config.yaml", sha: "b32ec16443d8f6fef6ba16913d33f0abfc3aa02d")
⎿ Path did not point to a file or directory, but resolved git ref to {"Ref":"","SHA":"b32ec16443d8f6fef6ba16913d33f0abfc3aa02d"} with possible path matches: ["localenv.config
.yaml"]
⎿ Interrupted by user
> sha and ref
✻ Thinking…
The user wants me to supply both sha and ref parameters. Let me try that.
⏺ github_twdcgrid - Get file or directory contents (MCP)(owner: "COST", repo: "baymax", path: "localenv.config.yaml", ref: "refs/heads/main", sha:
"b32ec16443d8f6fef6ba16913d33f0abfc3aa02d")
⎿ Path did not point to a file or directory, but resolved git ref to {"Ref":"","SHA":"b32ec16443d8f6fef6ba16913d33f0abfc3aa02d"} with possible path matches: ["localenv.config
.yaml"]
⎿ Interrupted by user
changed the title [-]`get_file_contents` is not working properly[/-][+]`get_file_contents` is not working properly (Path did not point to a file or directory, but resolved git ref)[/+]on Aug 13, 2025
Hi @nasxisbest , thank you for reporting this. I am struggling to reproduce this behaviour - is this still happening on your end, on the latest release too? And if so, may I ask which model you're using?
Path did not point to a file or directory, but resolved git ref to {"Ref":"refs/heads/main","SHA":"a2ffc6566e61b65ae9e98131f46390ecb3740c8a"} with possible path matches: ["README.md"]
Reacted by Zhongpin Wang, James Forward, Jonathan Bittner and Eugene Musika
I wonder if this is specific to GHE 3.16.2 (or just GHE)
I tried the same version of the mcp server against public github.com & it was able to retrieve a file just fine.
A bug with GHE?
I did some troubleshooting and found the following:
when running against our Github Enteprise Server, the GetRawContent call here returns a 406 error.
I then changed the Accept header in the github "raw" client to accept any type (req.Header.Set("Accept", "*/*") ). I was able to get rid of the 406 error but then client is redirected to a url that needs to go through SSO, so I am not able to reach the contents of the file as it just downloads the SSO page.
I wonder if we could just get the contents through the normal Github API endpoint using fileContent.GetContent()here instead of going through the raw github client.
I wonder if the remote server "https://api.githubcopilot.com/mcp" is released with this change? I am still getting the same error "Failed to get file contents. The path does not point to a file or directory, or the file does not exist in the repository." when talking to the remote github mcp. Thanks.
👋 We're actively looking at improving GHES support for the MCP server! If you have thoughts on GHES-specific needs, please share your feedback in this discussion. 🙏
Activity
[-]`get_file_contents` is not working properly[/-][+]`get_file_contents` is not working properly (Path did not point to a file or directory, but resolved git ref)[/+]tommaso-moro commentedon Aug 21, 2025
Hi @nasxisbest , thank you for reporting this. I am struggling to reproduce this behaviour - is this still happening on your end, on the latest release too? And if so, may I ask which model you're using?
keeganstreet commentedon Aug 21, 2025
Hi @tommaso-moro,
I'm running
ghcr.io/github/github-mcp-server:v0.12.1GitHub Enterprise Server: 3.16.2
I have tried with GPT 4.1, and Claude Sonnet 4, and they have the same error.
Prompt: Use Github MCP and summarise the readme from repo keegan-street/pr-reviewer.
It tries to use the
get_file_contentstool with the following arguments:Output:
jamesforwardnwboxed commentedon Aug 26, 2025
Also experiencing this.
planetf1 commentedon Sep 3, 2025
Seeing the same here with roo code.
Using 0.14 container image
Server is GitHub Enterprise Server 3.16.2
planetf1 commentedon Sep 3, 2025
I wonder if this is specific to GHE 3.16.2 (or just GHE)
I tried the same version of the mcp server against public github.com & it was able to retrieve a file just fine.
A bug with GHE?
jbittner-dimensional commentedon Sep 16, 2025
Also experiencing this with GitHub Enterprise. I'm able to get the contents of a directory, but not files.
alfredolopezzz commentedon Sep 19, 2025
I am also experiencing this
rubensilvapipedrive commentedon Sep 19, 2025
From my end I also have the issue
It seems to be only for Github enterprise MCPs.
For public repos it seems to fetch readmes just fine.
alfredolopezzz commentedon Sep 26, 2025
I did some troubleshooting and found the following:
when running against our Github Enteprise Server, the
GetRawContentcall here returns a 406 error.I then changed the
Acceptheader in the github "raw" client to accept any type (req.Header.Set("Accept", "*/*")). I was able to get rid of the 406 error but then client is redirected to a url that needs to go through SSO, so I am not able to reach the contents of the file as it just downloads the SSO page.I wonder if we could just get the contents through the normal Github API endpoint using
fileContent.GetContent()here instead of going through the raw github client.mgimenoromanadevinta commentedon Oct 8, 2025
Hello
Also experiencing this in GHE 3.15.8, GitHub MCP Server 0.17.1
Is there a planned fix?
Thanks
tonytrg commentedon Oct 10, 2025
Hey together,
sorry this one got buried. We are aware and we are looking into the problem.
Thank you for surfacing this one.
It has to do with the subdomain-isolation https://docs.github.com/en/enterprise-server@3.17/admin/configuring-settings/hardening-security-for-your-enterprise/enabling-subdomain-isolation#about-subdomain-isolation
tonytrg commentedon Oct 14, 2025
Fix PR #1218
tonytrg commentedon Oct 16, 2025
closing this one out please reopen if the fix does not work for you
seriousamlqz-qz commentedon Nov 3, 2025
I wonder if the remote server "https://api.githubcopilot.com/mcp" is released with this change? I am still getting the same error "Failed to get file contents. The path does not point to a file or directory, or the file does not exist in the repository." when talking to the remote github mcp. Thanks.
rubensilvapipedrive commentedon Nov 6, 2025
Seems like the issue is not fully fixed
#1285
tonytrg commentedon Nov 10, 2025
The fix was specifically regarding raw api + GHES with subdomain isolation.
This seems to be another problem regarding raw api + org related resources.
tonytrg commentedon Nov 19, 2025
Update. The 404s should be fixed now. This was a seperate issue to the GHES one. Thanks for reporting it.
seriousamlqz-qz commentedon Nov 19, 2025
tonytrg commentedon Nov 25, 2025
@seriousamlqz-qz the fix is internally, for our remote deployment of github mcp. This problem should not occur on the local version.
SamMorrowDrums commentedon Nov 25, 2025
👋 We're actively looking at improving GHES support for the MCP server! If you have thoughts on GHES-specific needs, please share your feedback in this discussion. 🙏