[Bug]: Changes tab never works for repos cloned from github
Is there an existing issue for the same bug? (If one exists, thumbs up or comment on the issue instead).
- [x] I have checked the existing issues.
Describe the bug and reproduction steps
I'm running OpenHands via the recommended Docker setup, plus mapping the workspace to a folder on the host system.
- The "Changes" tab always shows "Your current workspace is not a git repository. Ask OpenHands to initialize a git repo to activate this UI" (there is definitely a repo there)
- The logs show frequent messages like
GET /api/conversations/75e98ef4d0044697bd457446897aa297/git/changes HTTP/1.1" 404 Not Found
I asked the agent if it could see the repo, and it ran git config --global --add safe.directory /workspace. After that it worked.
It seems this tab should show a clearer message if the repo needs to be marked as "safe", and ideally give a button/option to do so. Additionally, if not marked as safe, it shouldn't continuously log 404s.
OpenHands Installation
Docker command in README
OpenHands Version
0.36.0
Operating System
Linux
Logs, Errors, Screenshots, and Additional Context
No response
Ah interesting. @metal450 when you have this, what directory does OpenHands start in?
If you go to the terminal and do a pwd. Does it start within your repo folder or one directory above it?
pwd prints /workspace. ls -a shows the repo (i.e. the .git folder is there)
And your repo is straight in the /workspace directory?
Yes. Or ls -a wouldn't show the .git folder there, lol ;)
this is the error from docker when I printed it. you can either catch it or just look for code 128. which is how im patching it in the meantimes openhands/runtime/utils/git_handler.py:_is_git_repo
this might also be a related types problem
I have the same issue here with the default docker setup + local filesystem sandbox mountain, happy to help debug
https://github.com/All-Hands-AI/OpenHands/blob/819bad077753a5329ea59ceeda9819a06b9c5805/openhands/runtime/utils/git_handler.py#L40
This is the file that is causing the problem in get_git_changes it calls the following function _is_git_repo. Im not a maintainer so I dont know if they will approve this type of patch, but maybe you can push it through.
@SquallLeonhart13 Sorry, I'm not sure off-hand what is the right fix for this issue, but you are most welcome to propose a PR and/or to join our slack channel and maybe propose it (we have a channel eng-pr-review for example), or just discuss the issue before. (channel eng-help is generally for bugs or strange behavior)
I also have the same issue with 0.39.1 version.
I accepted the suggestion from the main page to clone a repo. It was cloned under /workspace/my_project
I asked agent to do changes inside 'my_project' folder, which it did.
The changes were always empty and I see a message your current workspace is not a git repository, ask... to create a git repo
I believe this is fixed in https://github.com/All-Hands-AI/OpenHands/pull/8771
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.