I want to import TFS repo to git and clone into my local machine and I am using git-tf. Below my code:- git-tf clone http://server:8080/tfs/DefaultCollection $/SampleProject D:\TFSRepoName I want to pass username and password in url , so it automatic clone repo without asking for username and password.
If you don't want to be prompted for credentials every time you run git-tf
, you can store your credentials in your GIT configuration for your repository:
$ git config --global git-tf.server.username your-username
$ git config --global git-tf.server.password your-password
Note that your password will be stored in the git configuration file in plain text. Be sure to set the ACLs or file permissions as appropriate to discourage people from reading your password out of your configuration file. Or you can store just the username and you will need to type only your password each time.
Reference : Accessing TFS with git-tf
You can also try to install and Use the Git Credential Manager,
When you connect to a Git repository from your Git client for the first time, the credential manager will prompt for your credentials. Once authenticated, the credential manager will create and cache a personal access token for future connections to the repo. Git commands that connect to this account will not prompt for user credentials until the token expires or is revoked through VSTS/TFS.
git-tf
there isn't a way to pass the credential in URL, you have to restore the username and password to eCredential Managerer
or in the git configuration file as mentioned above. However you can try use git clone
as you mentioned if you enable the SSH ,type the credential in the URL. Otherwise you have to store the credential first. That means you need to expose the credential, it's at risky. You can reference this thread:#10054818 for this. –
Refutative One way to pass the credential is -
git pull http://username:password@url
Here "url" will be the url you use to clone the repository on tfs. But this way is not recommended. Instead you should go for credential manager.
I had to use the default windows credential manager (windows 10 comes with this feature).
- Control Panel\User Accounts\Credential Manager
- Click windows credentials
- Add generic credential
- git:(tfs url, no trailing slash) ... example: git:http://tfs
- username .. example: domain\username
- password
- save
Next time you use git for this url your saved credentials will be used
© 2022 - 2024 — McMap. All rights reserved.