Reputation: 143
I have written a shell script to clone the project from multiple location which is sent as a file. I read the file and pass the each location in a loop and perform my operation.
LocationFile.txt
Project1=https://[email protected]/my/path/testProject1.git
Project2=https://[email protected]/my/path/testProject2.git
Project3=https://[email protected]/my/path/testProject3.git
Project4=https://[email protected]/my/path/testProject3.git
Password.txt
Project1=password1
Project2=password2
Project3=password3
Project4=password4
I have a password file encrypted and stored in server, which I can read as part of script and passing into my script When I run my script during clone step its prompting for a password, I tried to pass the password like below which is not working
##############
gitpassword=$password1 #retrieved from Password.txt
for xxx
do
...
...
git clone "${ProjectArrayList[1]}"
read $gitpassword
...
..
done
##############
I know I can do password less if I use ssh, which I don't want to do. Is there a way to achieve this with my exsiting approach
Upvotes: 0
Views: 1886
Reputation: 33631
Git has a "credential helper" that can do the job [it is designed to work over https].
See: https://git-scm.com/docs/git-credential-store and https://help.github.com/articles/caching-your-github-password-in-git/
Upvotes: 1