Search code examples
git-tf

Cache TFS login credentials for git-tf


I use git and git-tf at my job, but every time I perform any command with git-tf I have to enter my login credentials. Is there a way to cache my TFS login credentials for git-tf so I won't have to enter them every time?


Solution

  • If you use Kerberos and have a trust relationship with the Active Directory domain that your TFS server is on, you need not enter any password, git-tf will use your Kerberos ticket to authenticate. This, of course, will only work with on-premises servers; it will not work with Team Foundation Service.

    To cache your username and password for the repository, you can set these in your .git/config:

    git config git-tf.server.username myusername
    git config git-tf.server.password mypassword
    

    However, do note that this will store your password in plain text, which is why Kerberos is preferred. I am interested in adding support for the git credential storage mechanisms, but this does not yet exist.