1

I'm writing a Windows Powershell script to set up a new development environment. One of the steps uses git clone in order to pull our project from Github. I'm using the following command:

git clone git@github.com:Account/Project.git C:\Project

This works, but git will prompt the user for their password. Unfortunately, this line of code executes in the middle of the Powershell script, and users don't realize that it's expecting their input because everything else is automated up until this point.

I'd like to prompt the user for their password when the script first executes, but how do I pass it to git clone? It doesn't look like it can accept a password as one of its parameters.

Daniel T.
  • 37,212
  • 36
  • 139
  • 206
  • github doesn't use passwords. The only reason I can think that this is happening in because their key has a password on it. Is this correct? I don't know how to fix it though. – Jarryd Mar 09 '12 at 03:57
  • Yes, that's correct. Their key has a password. Our repo is private. – Daniel T. Mar 09 '12 at 03:59
  • This discusses ssh-agent to only require keys being typed in once, but that doesn't quite do what you want does it? http://help.github.com/ssh-key-passphrases/ – Jarryd Mar 09 '12 at 04:13

1 Answers1

-1

If you want to use username & password, try

git clone https://Account:Password@github.com/Account/Project.git C:\Project

if OAuth token or personal access token (PAC)

git clone https://anything (for example Account, OAuth or x-token-auth):Token@github.com/Account/Project.git C:\Project

or

git clone https://Token:x-oauth-basic@github.com/Account/Project.git C:\Project

Git automation with OAuth tokens

galeksandrp
  • 766
  • 8
  • 17