feat: [CDE-192]: correctly cache login info during first checkout (#2515)

* feat: [CDE-192]: correctly cache login info during first checkout
pull/3545/head
Ansuman Satapathy 2024-08-15 05:33:11 +00:00 committed by Harness
parent d089d04025
commit 7a3df78d8b
2 changed files with 6 additions and 5 deletions

View File

@ -10,8 +10,8 @@ echo $password
EOF
chmod 700 $HOME/.git-askpass
git config --global credential.helper 'cache --timeout=2592000'
git config --global user.email $email
git config --global user.name $name
git config --global user.email "$email"
git config --global user.name "$name"
#run git operation to cache the credential in memory
export GIT_ASKPASS=$HOME/.git-askpass
git ls-remote

View File

@ -30,8 +30,8 @@ if ! command -v git >/dev/null 2>&1; then
exit 1
fi
git config --global user.email $email
git config --global user.name $name
git config --global user.email "$email"
git config --global user.name "$name"
# Clone the repository inside the working directory if it doesn't exist
if [ ! -d "$HOME/$repo_name/.git" ]; then
echo "Cloning the repository..."
@ -43,9 +43,10 @@ if [ ! -d "$HOME/$repo_name/.git" ]; then
else
echo "Repository already exists. Skipping clone."
fi
git ls-remote
rm $HOME/.git-askpass
git config --global --add safe.directory $HOME/$repo_name
git config --global --add safe.directory "$HOME/$repo_name"
# Check if .devcontainer/devcontainer.json exists
if [ ! -f "$HOME/$repo_name/.devcontainer/devcontainer.json" ]; then