unable to connect to cache daemon?

I am able to push fine, but I am suddenly getting this "fatal" message

$ git push
fatal: unable to connect to cache daemon: Bad file descriptor
Username for 'https://github.com':
Password for 'https://myid@github.com':
fatal: unable to connect to cache daemon: Bad file descriptor
...

Why do I get this message all of the sudden? and what do I do?

I am not sure this might help, but between now and before this problem occurred

  • I was working on some branch that is not master
  • I changed my user.email in git config --global in the middle
  • my computer crashed big time because I connected the wrong project connector(that is not for the computer) to it, and I believe somehow some file got corrupted
  • After that occurred, when I tried to make a new commit,I was getting the following message : fatal: Failed to resolve HEAD as a valid ref.
  • Then I fixed it by modifying HEAD in config to "ref: refs/heads/master"
  • After coding and successfully committing the changes locally, when I tried to push it to the remote server, I got the following error message

    $ git push

    fatal: unable to connect to cache daemon: Bad file descriptor Username for 'https://github.com': Password for 'https://myid0@github.com': fatal: unable to connect to cache daemon: Bad file descriptor fatal: loose object 8ce710b1c78658e066cd2309b12b7766d1be4920 (stored in .git/objects/8c/e710b1c78658e066cd2309b12b7766d1be4920) is corrupt fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly fatal: write error: Bad file descriptor

  • So I backed up all the changes I made, deleted the repo, clone the repo from the github, and made some changes with the backup files, add, commit, and pushed the changes fine...but still that message does not go away :(

Answers


https://stackoverflow.com/a/14160580

solved this for me:

sudo chown kev ~/.git-credential-cache/socket

replace kev with your user if you don't know your user:

whoami

This error comes when you try to commit using "sudo". so the password saved is for "sudo" user only, But when you try to commit as a normal user, This error happens, permission denied for normal user you can get rid of this error by using above answer Kev Price


Beware of manipulating ~/.git-credential-cache/socket (as with chown), for it has moved since 2014, as acknowledge by Git 2.13 (Q2 2017)

See commit 612c49e, commit 60759ba (17 Mar 2017), and commit e7f136b (13 Mar 2017) by Devin Lehmacher (lehmacdj). (Merged by Junio C Hamano -- gitster -- in commit 78cf8ef, 24 Mar 2017)

credential-cache: use XDG_CACHE_HOME for socket

Make git-credential-cache follow the XDG base path specification by default. This increases consistency with other applications and helps keep clutter out of users' home directories.

Check the old socket location, ~/.git-credential-cache/, and use ~/.git-credential-cache/socket if that directory exists rather than forcing users who have used git credential-cache before to migrate to the new XDG compliant location.

Otherwise use the socket $XDG_CACHE_HOME/git/credential/socket following XDG base path specification. Use the subdirectory credential/ in case other files are cached under $XDG_CACHE_HOME/git/ in the future and to make the socket's purpose clear.


Try to set global gitconfig.

git config --global user.name "your username"
git config --global user.email "your email address"

Need Your Help

How to implode a vector of strings into a string (the elegant way)

c++ string stl stdstring implode

I'm looking for the most elegant way to implode a vector of strings into a string. Below is the solution I'm using now: