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://[email protected]':
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
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://[email protected]': 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 :(
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
Beware of manipulating ~/.git-credential-cache/socket
(as with chown
), for it has moved since 2014, as acknowledge by Git 2.13 (Q2 2017)
Adam K Dean also mention in the comments the path ~/.cache/git/credential/
, which just needed chowning back to the user.
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 usedgit 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 subdirectorycredential/
in case other files are cached under$XDG_CACHE_HOME/git/
in the future and to make the socket's purpose clear.
Note: With Git 2.29 (Q4 2020), a handful of places in in-tree code still relied on being able to execute the git
(man) subcommands, especially built-ins, in "git-foo
" form, which have been corrected.
See commit c0e190c, commit 7cff3b6, commit 675df19 (26 Aug 2020) by Junio C Hamano (gitster
).
(Merged by Junio C Hamano -- gitster
-- in commit 18aff08, 03 Sep 2020)
credential-cache
: usechild_process.args
As
child_process
structure has an embeddedstrvec args
for formulating the command line, let's use it instead of using an out-of-lineargv[]
whose length needs to be maintained correctly.Also, when spawning a
git
subcommand, omit it from the command list and instead use the.git_cmd
bit in thechild_process
structure.
So, no more call to git-credential-cache--daemon
, but rather git credential-cache--daemon
.
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
Quick solution
Here is the single command you need to solve the issue.
sudo chown $(whoami) ~/.cache/git/credential/socket
Read the other answers if you want a deeper understanding of what causes this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With