Permanent authentication for Git repositories over HTTP(S)
Currently, Fisheye only supports HTTP or HTTPS for pushing and pulling from Git repositories. Git has no method of caching the user's credentials, so you need to re-enter them each time you perform a clone, push or pull.
Fortunately, there is a mechanism that allows you to specify which credentials to use for which server: the
Git uses a utility called cURL under the covers, which respects the use of the .netrc file. Be aware that other applications that use curl to make requests to servers defined in your
.netrc file will also now be authenticated using these credentials. Also, this method of authentication is potentially unsuitable if you are accessing your Fisheye server via a proxy, as all curl requests that target a path on that proxy server will be authenticated using your
cURL will not match the machine name in your .netrc if it has a username in it, so make sure you edit your
.git/config file in the root of your clone of the repository and remove the user and '@' part from any clone url's (url fields) that look like
https://firstname.lastname@example.org/... so instead they look like
Linux or OSX
- Create a file called
.netrcin your home directory (
~/.netrc). Unfortunately, the syntax requires you to store your passwords in plain text - so make sure you modify the file permissions to make it readable only to you.
Add credentials to the file for the server or servers you want to store credentials for, using the format below. You may use either IP addresses or hostnames, and you do not need to specify a port number, even if you're running Fisheye on a non-standard port.
machine fisheye1.mycompany.com login myusername password mypassword machine fisheye2.mycompany.com login myotherusername password myotherpassword
- And that's it! Subsequent
git pushrequests will be authenticated using the credentials specified in this file.
- Create a text file called
_netrcin your home directory (e.g.
c:\users\kannonboy\_netrc). Curl has problems resolving your home directory if it contains spaces in its path (e.g.
c:\Documents and Settings\kannonboy). However, you can update your
%HOME%environment variable to point to any old directory, so create your
_netrcin a directory with no spaces in it (for example
c:\curl-auth\) then set your
%HOME%environment variable to point to the newly created directory.
- Add credentials to the file for the server or servers you want to store credentials for, using the format from the Linux or OSX section above.