Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When do you need ./gitcookies?

Tags:

git

github

I see often this code around:

#!/bin/bash

touch ~/.gitcookies
chmod 0600 ~/.gitcookies

git config --global http.cookiefile ~/.gitcookies

tr , \\t <<\__END__ >>~/.gitcookies
.googlesource.com,TRUE,/,TRUE,2147483647,o,git-paul.hashicorp.com=1/z7s05EYPudQ9qoe6dMVfmAVwgZopEkZBb1a2mA5QtHE
__END__

https://github.com/ewilde/terraform-provider-runscope/blob/master/scripts/gogetcookie.sh

I searched for "gitcookie" but couldn't find a clear good resource (a.k.a a stackoverflow post)

like image 312
fabrizioM Avatar asked Jul 31 '26 15:07

fabrizioM


1 Answers

gitcookies is in this case an arbitrary filename. You can choose any name that you want. The relevant part is the configuration property, where this filename is set. That property is in this case http.cookiefile. According to the documentation, it's described as following:

The pathname of a file containing previously stored cookie lines, which should be used in the Git http session, if they match the server. The file format of the file to read cookies from should be plain HTTP headers or the Netscape/Mozilla cookie file format (see curl(1)). NOTE that the file specified with http.cookieFile is used only as input unless http.saveCookies is set.

So basically you would need it, if you access a remote Git repository through HTTP and if that server uses cookies e.g. for authentication purposes.

like image 197
dunni Avatar answered Aug 03 '26 09:08

dunni



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!