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.
how to pass username and password while cloning TFS to git in window powershell
15.9k views Asked by Priya Rani At
3
There are 3 answers
0
On
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.
0
On
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
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: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,