cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Git folder fails with "Input/output error" on .git/index and edited files, even after a fresh clone

khacdat-dang
New Contributor

Hi all,

I'm hitting persistent Git errors in Databricks Git folders (Repos) and would appreciate any advice.

Environment

  • Cloud: AWS
  • Compute: serverless only
  • Repo: private GitHub repository, working on a develop branch
  • Contents: a Declarative Automation Bundle with Lakeflow Spark Declarative Pipelines source files (.py / .sql)

What happens

  1. My original Git folder suddenly became unreadable. Every Git operation fails with: "This folder could not be read as a Git repository. Please try again. If the problem persists, you may need to delete and re-clone the Git folder." Running git status returns fatal: not a git repository (or any parent up to mount point /), but the .git contents look valid when I browse them (HEAD points to refs/heads/develop, and the refs, objects and config are all present). The Git dialog also shows a detached HEAD, which doesn't match the HEAD file.

  2. I cloned the repo into a new Git folder. The clone and the checkout of develop worked, and the status was clean.

  3. I then made a one-line edit (added a comment) to a .py file in the new folder. The next Git operation failed with: fatal: .git/index: index file open failed: Input/output error

  4. After that, status still lists the file as modified, but the diff fails every time with: error: open("<path>/sample_trips_dbrain_lakeflow.py"): Input/output error fatal: cannot hash <path>/sample_trips_dbrain_lakeflow.py The workspace editor can still open and read the file.

Other observations

  • There is no index.lock left in .git.
  • After the edit, ORIG_HEAD appeared in .git and .git/config was rewritten, the same pattern I saw in the original folder before it broke.

What I've tried

  • Retrying the operation and refreshing the Git dialog
  • Re-cloning into a new Git folder (works until a file is edited)

Questions

  1. Has anyone seen "Input/output error" on .git/index or on working-tree files in Git folders? Is this a known issue?
  2. Could the file being part of a pipeline or bundle source folder matter (for example, the pipeline editor holding the file)?
  3. Is there a workaround other than repeatedly re-cloning?
1 ACCEPTED SOLUTION

Accepted Solutions

Mateus-Moreira
New Contributor II

My First Recommendation: Test Git CLI Instead of the Standard Git Folder

Databricks offers a feature called Git CLI access, currently in Public Preview.

It allows you to execute Git commands directly on Serverless Compute, including through the Web Terminal.

According to the documentation:

  • Git Folders created through the UI automatically receive Git CLI access when the workspace is eligible.

  • Clones performed through the Web Terminal always have Git CLI access.

  • This feature allows you to perform standard Git operations directly in the Serverless environment.

Reference: Databricks on AWS โ€“ Git CLI access.

I would run this test before trying anything else.

Procedure:

  1. Open the Databricks Web Terminal.

  2. Clone the repository into a new directory:

cd /Workspace/Users/<username>

git clone --branch develop \
  https://github.com/<org>/<repo>.git \
  repo-test
  1. Navigate to the cloned repository:

cd repo-test
  1. Make a small change to a .py file:

echo "# git test" >> sample_trips_dbrain_lakeflow.py
  1. Run the following commands:

git status
git diff
git add sample_trips_dbrain_lakeflow.py
git status

How to interpret the results:

  • If everything works: This strongly suggests an issue specific to the standard Git Folder implementation or its integration with the workspace editor.

  • If the same Input/output error occurs: The issue may be broader, potentially involving filesystem access within the Databricks workspace.

This test does not guarantee a fix, but it should help isolate the root cause.

Mateus Moreira | Data Analyst Engineer

View solution in original post

2 REPLIES 2

Mateus-Moreira
New Contributor II

My First Recommendation: Test Git CLI Instead of the Standard Git Folder

Databricks offers a feature called Git CLI access, currently in Public Preview.

It allows you to execute Git commands directly on Serverless Compute, including through the Web Terminal.

According to the documentation:

  • Git Folders created through the UI automatically receive Git CLI access when the workspace is eligible.

  • Clones performed through the Web Terminal always have Git CLI access.

  • This feature allows you to perform standard Git operations directly in the Serverless environment.

Reference: Databricks on AWS โ€“ Git CLI access.

I would run this test before trying anything else.

Procedure:

  1. Open the Databricks Web Terminal.

  2. Clone the repository into a new directory:

cd /Workspace/Users/<username>

git clone --branch develop \
  https://github.com/<org>/<repo>.git \
  repo-test
  1. Navigate to the cloned repository:

cd repo-test
  1. Make a small change to a .py file:

echo "# git test" >> sample_trips_dbrain_lakeflow.py
  1. Run the following commands:

git status
git diff
git add sample_trips_dbrain_lakeflow.py
git status

How to interpret the results:

  • If everything works: This strongly suggests an issue specific to the standard Git Folder implementation or its integration with the workspace editor.

  • If the same Input/output error occurs: The issue may be broader, potentially involving filesystem access within the Databricks workspace.

This test does not guarantee a fix, but it should help isolate the root cause.

Mateus Moreira | Data Analyst Engineer

khacdat-dang
New Contributor

Thank you so much !

It finally worked for me !!