git-commit-id-maven-plugin
git-commit-id-maven-plugin copied to clipboard
Cannot save config file 'FileBasedConfig[H:\.config\jgit\config]'
Describe the bug
During maven build, we observe the following error message from git-commit-id-maven-plugin 4.0.5:
Cannot save config file 'FileBasedConfig[H:\.config\jgit\config]'
The H: drive is a network drive where our home dir is set
Steps to Reproduce
mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\<redacted>\tools\maven\3.6.3
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: C:\Program Files\Java\JDK8\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
- Plugin config:
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.5</version>
<configuration>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<offline>true</offline>
</configuration>
</plugin>
- no public build
- Observed error:
Cannot save config file 'FileBasedConfig[H:\.config\jgit\config]'
This error doesn not prevents the maven build from being executed with success. However, intelliJ Community 2019.3 spots it as an error:

Expected behavior
- no error message printed
Additional context
This might be similar to https://www.eclipse.org/forums/index.php/t/1103395/
Hello, thank you for reporting this issue here! When I read the linked ticket (https://bugs.eclipse.org/bugs/show_bug.cgi?id=566170) correctly this should be fixed whenever we update the jgit-library to version 5.9?!?
For the time being you could potentially switch to the native git binary via <useNativeGit>true</useNativeGit> which would help avoid that issue since it doesn't rely on jgit.
Ah I just realized that this is essentially a duplicate of https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/518. At least it's the same issue. Perhaps a different context....not sure if I should keep both issues open, but I guess it doesn't hurt either.
The difference with #518 is that there the build fails while in this case it does not
thanks for the useNativeGit tip!
thanks for pointing out that difference!
Could you perhaps also confirm which version you are using?
If you are on 4.0.5 this should already include jgit 5.12.0.202106070339-r (see https://github.com/git-commit-id/git-commit-id-maven-plugin/blob/v4.0.5/core/pom.xml#L20). Based on the closed bug report (https://bugs.eclipse.org/bugs/show_bug.cgi?id=566170) this should have been fixed in 5.9.X....hence this would make me suspect that it is not fixed properly and would deserve a new ticket, or to have the old to be reopened.
Same problem here with 4.9.10:
[INFO] --- git-commit-id-plugin:4.9.10:revision (default) ...
[ERROR] Cannot save config file 'FileBasedConfig[H:\.config\jgit\config]'
java.io.IOException: Creating directories for H:\.config\jgit failed
<useNativeGit>false</useNativeGit>
doesn't make a difference
Sorry it should have been <useNativeGit>true</useNativeGit> I have updated my initial comment.
@TheSnoozer we're actually observing the same problem now in https://github.com/VirtusLab/git-machete-intellij-plugin/issues/1239 ... despite using the latest JGit (6.3.0.202209071007-r) ☹️
Thanks for raising this! I guess we should then (re-)open a ticket with jgit :-(
Yes, if you could 🙏🏻 pls mention me on that ticket (if that's on GitHub) or provide the link for the ticket (otherwise) 🎫
Actually... seems that it can be closed: https://github.com/VirtusLab/git-machete-intellij-plugin/issues/1239#issuecomment-1274786576
Hi everyone. I came across the same issue on the gradle plugin for git commit id.
To rule solutions out, I tried to create the .config directory manually and that works correctly. I also tried to manually exclude the jgit dependency and manually include newer versions which still produced the error.
Did anyone find the cause of this that could maybe be applied to the gradle plugin also? Thanks