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

GitBlit trires to read current user''s .gitconfig on creating a repo #475

Closed
gitblit opened this issue Aug 12, 2015 · 5 comments
Closed

Comments

@gitblit
Copy link
Collaborator

gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 179

What steps will reproduce the problem?
1. Log in to GitBlit
2. Click "new repository"
3. Click save

What is the expected output? What do you see instead?
I expect a new repo. I get an Internal Error

What version of the product are you using? On what operating system?
v 1.1.0, running on Windows 7. java version "1.7.0_07"

Please provide any additional information below.

Why is it even looking at my .gitconfig?

Removing .gitconfig is a workaround.

Partial stack trace:
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: User config file C:\Users\Tom\.gitconfig
invalid org.eclipse.jgit.errors.Confi
gInvalidException: Cannot read file C:\Users\Tom\.gitconfig
        at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:95)
        at com.gitblit.utils.JGitUtils.createRepository(JGitUtils.java:264)
        at com.gitblit.GitBlit.updateRepositoryModel(GitBlit.java:1259)
        at com.gitblit.wicket.pages.EditRepositoryPage$2.onSubmit(EditRepositoryPage.java:304)
        at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1595)
        at org.apache.wicket.markup.html.form.Form.process(Form.java:960)
        at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:922)
        ... 34 more
Caused by: java.io.IOException: User config file C:\Users\Tom\.gitconfig invalid org.eclipse.jgit.errors.ConfigInvalidException:
Cannot read
 file C:\Users\Tom\.gitconfig
        at org.eclipse.jgit.storage.file.FileRepository.loadUserConfig(FileRepository.java:213)
        at org.eclipse.jgit.storage.file.FileRepository.<init>(FileRepository.java:168)
        at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:573)
        at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:90)
        ... 40 more
Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Cannot read file C:\Users\Tom\.gitconfig
        at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:156)
        at org.eclipse.jgit.storage.file.FileRepository.loadUserConfig(FileRepository.java:211)
        ... 43 more
Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Invalid line in config file
        at org.eclipse.jgit.lib.Config.fromText(Config.java:1036)
        at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:144)

Reported by tomdatafellow on 2012-12-11 02:03:12

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Gitblit is not explicitly reading your personal config.  JGit is reading your config
as part of it's implementation of "git init".  This is beyond my control and also beyond
my knowledge of "yes, git does this too" or "no, git does not do that".

I think the more interesting question is why can't it read your config?  Perhaps further
down into that stacktrace there might be a line number? Caused by: org.eclipse.jgit.errors.ConfigInvalidException:
Invalid line in config file

Reported by James.Moger on 2012-12-11 13:12:44

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Lacking further information about the contents of the .gitconfig file, I don't consider
this a bug.  If you feel otherwise please re-open and we can further discuss.

Reported by James.Moger on 2012-12-21 21:59:59

  • Status changed: WontFix

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

I have just encountered this issue with 1.5.1. I get this error even with a very minimal
.gitconfig:

name = Ian Barton
email = ian@manor-farm.org

The file is owned by me and has 777 permissions. Stack trace:

Caused by: java.io.IOException: User config file /home/ian/.gitconfig invalid org.eclipse.jgit.errors.ConfigInvalidException:
Cannot read file /home/ian/.gitconfig
        at org.eclipse.jgit.internal.storage.file.FileRepository.loadUserConfig(FileRepository.java:236)
        at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:190)
        at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:573)
        at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:90)
        ... 41 more
Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Cannot read file /home/ian/.gitconfig
        at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:173)
        at org.eclipse.jgit.internal.storage.file.FileRepository.loadUserConfig(FileRepository.java:234)
        ... 44 more
Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Invalid line in config file
        at org.eclipse.jgit.lib.Config.fromText(Config.java:1087)
        at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:161)

Reported by ian@wilkesley.com on 2014-05-20 17:46:36

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

If that truly is your .gitconfig, you have formatting issues.

[user]
    name = James Moger
    email = james.moger@gitblit.com
[push]
    default = simple

Reported by James.Moger on 2014-05-20 17:50:03

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

OK thanks for the help. Problem now solved. That was just my gitconfig chopped down
to the absolute minimum. The problem was a missing [user] declaration. That's definitely
an error, but in my defence nothing else has ever complained about it:)

Reported by ian@wilkesley.com on 2014-05-21 07:05:42

@gitblit gitblit closed this as completed Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant