0

I am running a bash script that automatically clones a git repo.make the changes in the provided git repo and then push those changes to github.now when i am cloning the repo it asks me for my username and i don't know how to provide these inputs in a bash script.for privileges i am blacking out some things.but i will explain the rest of it to you.i have tried git config but it won't work.can somebody please help me with this

#!/bin/bash
set -e
appName=$(echo xxxxx/xxxxx)
echo $appName
version=`echo "$BRANCH_NAME-$BUILD_NUMBER" | tr / -`
echo $version
imageName=$appName:$version
echo $imageName
git config --global user.name "xxxxxxxx"
git config --global user.email "xxxxxxxxxxx"
git config --global user.password "xxxxxxxxxxxxxx"
git clone https://github.com/xxxxx/xxxxx.git
cd qa-namespace/red/website-manager
sed -i "s|\(image[[:space:]]*:[[:space:]]*\)\(.*\)|\1'${imageName}'|"  input deployment.yaml
git add .
git commit -m "changed name of the branch"
git push
Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74

1 Answers1

0

You should change git clone https://github.com/xxxxx/xxxxx.git into git clone https://<USER_NAME>:<USER_PASSWORD>@github.com/xxxxx/xxxxx.git

Antonio Petricca
  • 8,891
  • 5
  • 36
  • 74