Skip to content
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

Error: JGitInternalException: Exception caught during execution of merge command #139

Open
Petros0 opened this issue Jan 19, 2025 · 13 comments
Assignees

Comments

@Petros0
Copy link

Petros0 commented Jan 19, 2025


Android Version: 14 (SDK 34)
Device Model: samsung SM-S921B
App Version: 1.641 (1641)

TEST: GITHUB
PullFromRepo: Closing repository
Sync: Pull Complete
Sync: Start Push Repo
PushToRepo: Getting local directory
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Pushing changes
TEST: GITHUB
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Closing repository
Sync: Push Not Required
Sync: Sync Complete
AccessibilityService: Application Closed
ToServiceCommand: AccessibilityService Sync
Sync: Start Sync
Sync: Start Pull Repo
PullFromRepo: Getting local directory
PullFromRepo: Fetching changes
TEST: GITHUB
PullFromRepo: Pulling changes
TEST: GITHUB
PullFromRepo: Closing repository
Sync: Pull Complete
Sync: Start Push Repo
PushToRepo: Getting local directory
GitStatus: HasUncommittedChanges: true
Missing: []
Modified: [Quicknote.md]
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: [Quicknote.md]
PushToRepo: Adding Files to Stage
PushToRepo: Getting current time
PushToRepo: Committing changes
PushToRepo: Pushing changes
TEST: GITHUB
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Closing repository
Sync: Push Complete
Sync: Sync Complete
AccessibilityService: Application Opened
ToServiceCommand: AccessibilityService Sync
Sync: Start Sync
Sync: Start Pull Repo
PullFromRepo: Getting local directory
PullFromRepo: Fetching changes
TEST: GITHUB
PullFromRepo: Pulling changes
TEST: GITHUB
PullFromRepo: Closing repository
Sync: Pull Complete
Sync: Start Push Repo
PushToRepo: Getting local directory
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Pushing changes
TEST: GITHUB
AccessibilityService: Application Closed
ToServiceCommand: AccessibilityService Sync
Sync: Sync Scheduled
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Closing repository
Sync: Push Not Required
Sync: Sync Complete
Sync: Scheduled Sync Starting
Sync: Start Sync
Sync: Start Pull Repo
PullFromRepo: Getting local directory
PullFromRepo: Fetching changes
TEST: GITHUB
PullFromRepo: Pulling changes
TEST: GITHUB
PullFromRepo: Closing repository
Sync: Pull Complete
Sync: Start Push Repo
PushToRepo: Getting local directory
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Pushing changes
TEST: GITHUB
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: [.obsidian]
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Closing repository
Sync: Push Not Required
Sync: Sync Complete
TEST: content://com.android.externalstorage.documents/tree/primary%3AVault
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
TEST: content://com.android.externalstorage.documents/tree/primary%3AVault
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
TEST: content://com.android.externalstorage.documents/tree/primary%3AVault
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
TEST: content://com.android.externalstorage.documents/tree/primary%3AVault
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
AccessibilityService: Application Opened
ToServiceCommand: AccessibilityService Sync
Sync: Start Sync
Sync: Start Pull Repo
PullFromRepo: Getting local directory
PullFromRepo: Fetching changes
TEST: GITHUB
PullFromRepo: Pulling changes
TEST: GITHUB
PullFromRepo: Error: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of merge command. java.io.IOException: Operation not permitted
at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:413)
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:322)
at com.viscouspot.gitsync.util.GitManager.downloadChanges(GitManager.kt:241)
at com.viscouspot.gitsync.GitSyncService$sync$job$1.invokeSuspend(GitSyncService.kt:147)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: java.io.IOException: Operation not permitted
at java.io.UnixFileSystem.createFileExclusively0(Native Method)
at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:368)
at java.io.File.createTempFile(File.java:2023)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1238)
at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:451)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:396)
at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:288)
... 9 more

PullFromRepo: Error: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of merge command. java.io.IOException: Operation not permitted
at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:413)
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:322)
at com.viscouspot.gitsync.util.GitManager.downloadChanges(GitManager.kt:241)
at com.viscouspot.gitsync.GitSyncService$sync$job$1.invokeSuspend(GitSyncService.kt:147)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: java.io.IOException: Operation not permitted
at java.io.UnixFileSystem.createFileExclusively0(Native Method)
at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:368)
at java.io.File.createTempFile(File.java:2023)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1238)
at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:451)
at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:396)
at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:288)
... 9 more

@ViscousPot
Copy link
Owner

It looks like your git repo is in a bad state somehow. There are a few things you can do

  • If it is in the middle of a merge and you have access to termux git, you can git merge --abort in the directory
  • If you are sure it's not in the middle of a merge, you should be able to get the repo out of a lock by deleting the index.lock file in the .git folder, but this is not recommended
  • The best and general solution is to reclone and resetup the repo

If you get this issue even after resetting up, please do let me know
There is also a more recent version of the app available that may help resolve your issues

@ViscousPot ViscousPot changed the title Pull failing Error: JGitInternalException: Exception caught during execution of merge command Jan 20, 2025
@Petros0
Copy link
Author

Petros0 commented Jan 20, 2025

Hey,

Thanks for the quick response.

The problem is that I always have to reset the repository. After I reset it and then I push something from any other device, then the sync doesn't work.

One another problem that I have, is that sometimes after cloning the repository gitsync will delete some the files and then I have to revert from desktop. (I am not sure why this happens tbh...)

@ViscousPot
Copy link
Owner

Can you confirm that you still see this in the latest version?
I'll have a deeper dive

@ViscousPot
Copy link
Owner

Could you:

  • let me know
    • what auth method you are using
    • what your repo generally consists of (lots of small files, a few large files etc.)
    • if you've given the app all the permissions it asks for
  • provide logs from just after you have reset it?

@ViscousPot ViscousPot self-assigned this Jan 20, 2025
@Petros0
Copy link
Author

Petros0 commented Jan 21, 2025

So, I did the following steps:

  • Removed the repository
  • Reinstalled gitsync
  • Use github for authentication
  • Cloned the repository with a lot of small files
  • Sync changes (I didn't even open obsidian in this case)

After syncing the changes my files were removed.

!-- PROVIDE ERROR REPRO STEPS -->


Android Version: 14 (SDK 34)
Device Model: samsung SM-S921B
App Version: 1.701 (1701)

TEST: GITHUB
TEST: GITHUB
GithubOAuthFlow: Launching Flow
GithubOAuthFlow: Flow Ended
TEST: GITHUB
GithubAuthCredentials: Auth Token Obtained
GithubAuthCredentials: Getting User Profile
GithubAuthCredentials: Username Retrieved
GithubAuthCredentials: Username and Token Received
TEST: GITHUB
GetRepos: Getting User Repos
GetRepos: Repos Received
CloneRepo: Cloning Repo
TEST: GITHUB
CloneRepo: Operation not permitted
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved
ToServiceCommand: Force Sync
Sync: Start Sync
Sync: Start Pull Repo
PullFromRepo: Getting local directory
PullFromRepo: Fetching changes
TEST: GITHUB
PullFromRepo: Closing repository
Sync: Pull Not Required
Sync: Start Push Repo
PushToRepo: Getting local directory
GitStatus: HasUncommittedChanges: true
Missing: []
Modified: []
Removed: [ personal files here]
IgnoredNotInIndex: []
Changed: []
Untracked: [ personal files here ]
Added: []
Conflicting: []
UncommittedChanges: [ personal files here ]
PushToRepo: Adding Files to Stage
PushToRepo: Getting current time
PushToRepo: Committing changes
PushToRepo: Pushing changes
TEST: GITHUB
GitStatus: HasUncommittedChanges: false
Missing: []
Modified: []
Removed: []
IgnoredNotInIndex: []
Changed: []
Untracked: []
Added: []
Conflicting: []
UncommittedChanges: []
PushToRepo: Closing repository
Sync: Push Complete
Sync: Sync Complete
RecentCommits: .git folder found
RecentCommits: Recent commits retrieved

@ViscousPot
Copy link
Owner

ViscousPot commented Jan 21, 2025 via email

@Petros0
Copy link
Author

Petros0 commented Jan 21, 2025

Hey, yeah sure. I'll do that later this evening.

Yeah this happens reliably.

@Petros0
Copy link
Author

Petros0 commented Jan 23, 2025

Hey @ViscousPot, here is a screen recording (https://drive.google.com/file/d/1wfbT4V66YWUTYbLqDQpOmKBG1pXbfggF/view?usp=sharing).

Is it maybe the issue that after the clone fails? (maybe not all files are downloaded? 🤔 ) and then when I sync git just thinks they are removed? I'm quite unsure tbh.

When I clone the repo I get an error (Operation not permitted), I am not sure why this happens, but if I try to sync manually I can see which files are going to be deleted.

I tried to force-pull via the UI function that you provide, but this also fails with Operation not permitted.

I am wondering if it is something with my file system, but I don't think since GitSync has all the required permissions + some of the files are already cloned successfully.

I can't understand how it determines which files are removed, it is totally random and spread throughout my repository.

@ViscousPot
Copy link
Owner

ViscousPot commented Jan 23, 2025

Thanks for the detailed response! I'll keep looking into this and see if I can repro

Can you confirm that you have storage space left on your device? I'm seeing online that this is sometimes caused by the app running out of space to clone into
Also curious if you see this on any of your other repos? It would be ideal if you have a public repo that has this same issue so I can attempt to use it to repro on my end :)

@Petros0
Copy link
Author

Petros0 commented Jan 23, 2025

Yeah I have enough space (around 150gb). The repo is around 150 MB.

Sadly I can't make my repo public since it has my obsidian notes and I prefer keeping it private.

@ViscousPot
Copy link
Owner

Oh of course!

I mean, is there any other repo on your account or otherwise that causes this same issue for you, that you WOULD be willing to make public? Maybe a new repo initialised with readme?

@Petros0
Copy link
Author

Petros0 commented Jan 25, 2025

I tried also some of the of my repositories but it worked without problems. Let's close the issue then, something must be wrong with the repo... If I find out I'll inform you. 😊

@ViscousPot
Copy link
Owner

I'll leave it open so I can revisit it and so that other people with a similar issue can add to the conversation if they like.

Thanks for reporting this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants