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 while running git #105

Closed
lukaszwit opened this issue Feb 4, 2016 · 11 comments
Closed

Error while running git #105

lukaszwit opened this issue Feb 4, 2016 · 11 comments

Comments

@lukaszwit
Copy link

I'm not sure if it's grumphp error but just after installation ( composer require phpro/grumphp ) I get this error on each commit:

  [Gitonomy\Git\Exception\ProcessException]                                                                                                                                                          
  Error while running git:
  error: Could not expand include path '~/.gitcinclude'                                                                                                                                              
  fatal: bad config file line 49 in /usr/local/git/etc/gitconfig 

I've got grumphp 0.7.2 running on osx and my git config looks like this -> https://github.com/timcharper/git_osx_installer/blob/master/assets/etc/gitconfig.default

@veewee
Copy link
Contributor

veewee commented Feb 4, 2016

The error is saying that a include file could not be found / read.
Look at the lines:
https://github.com/timcharper/git_osx_installer/blob/master/assets/etc/gitconfig.default#L47-L48

Can you verify if this file exists, is readable and does not contain an error?
I guess this is a problem with your git configuration.

@lukaszwit
Copy link
Author

The file ~/.gitcinclude was not existed so (now) I've created it with empty content but still the same error.
It has same permissions as ~/.gitconfig -> -rw-r--r--
My guess that empty file is not enough and should have some parsable content?

@veewee
Copy link
Contributor

veewee commented Feb 5, 2016

Can't you just remove the lines of the gitconfig.default?
Maybe it's also easier to just brew install git ?

@veewee veewee added the question label Feb 7, 2016
@mharbers
Copy link

I've got the same issue on OS X 10.11.3 and Git 1.7.9.5.

Removing the lines causes an other error:
[Gitonomy\Git\Exception\ProcessException] Error while running git command: 'git' '--git-dir' '/Volumes/data/sandbox/grumphp/.git' '--work-tree' '/Volumes/data/sandbox/grumphp' 'diff' '-r' '-p' '-m' '-M' '--full-index' '--staged' fatal: failed to expand user dir in: '~/.gitignore'

brew install git didn't solve it

@mharbers
Copy link

Found a workaround by changing the following in 'gitconfig':

Under core change:
'excludesfile = ~/.gitignore'
into:
'excludesfile = /Users/my-username/.gitignore'

Under include change:
'path = ~/.gitcinclude'
into:
'path = /Users/my-username/.gitcinclude'

I created the ~/.gitcinclude-folder manually. Seems to work for now.

@veewee
Copy link
Contributor

veewee commented Feb 29, 2016

So it is a GIT configuration issue?
Can you tell me how you first installed GIT? Maybe a bug report should be added to another project.

@veewee veewee added the wontfix label Mar 30, 2016
@veewee
Copy link
Contributor

veewee commented Mar 30, 2016

Since this is a GIT issue, I will close this ticket for now. Additional information is always welcome!

@veewee veewee closed this as completed Mar 30, 2016
@bizmate
Copy link

bizmate commented Jul 15, 2016

If anyone has found a definitive solution to this problem or opened a ticket on brew to fix this could you please share it here?

@veewee
Copy link
Contributor

veewee commented Nov 16, 2016

The problem is due to git running as a user without a home directory.
You can fix the issue with this command:

sed -i.bak '\#~/#d' /usr/local/git/etc/gitconfig 

It will remove the lines that require the home directory from the global git config file.
You could also hardocde the absolute path to the files in this config file.

As far as I can see, there is no open ticket in brew at the moment.

@DragSociety
Copy link

I seem to have a similar issue. Whenever i try to create a Git branch, this is what it tells me:

fatal: failed to expand user dir in: '~.gitignore_global'

Does anyone know what i have to do to undo this?

@jaroslavtyc
Copy link

jaroslavtyc commented Aug 15, 2018

In my case it was caused by running git pull under Apache, therefore user www-data.
I am still not sure why www-data under Apache does not have set $HOME dir (on my Linux Mint), though the user itself has the home dir set, but the simplest workaround for me was to set the home dir before git pull:
export HOME=/var/www && git pull

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

6 participants