Difference between revisions of "Git/Bitbucket"

From Ever changing code
< Git
Jump to navigation Jump to search
(Created page with "Download all repositories from Bitbucket Server over https and basic auth <source lang=bash> #!/bin/bash REPOS=( repo1 repo2 ) BITBUCKET_USER=myuser BITBUCKET_PASS=$(echo cG...")
 
 
Line 8: Line 8:
)
)


BITBUCKET_USER=myuser
BITBUCKET_PASS=$(echo cGFzc3dvcmQxCg== | base64 -d)
BITBUCKET_HOST=bitbucket.org
for REPO in ${REPOS[@]}; do
for REPO in ${REPOS[@]}; do
   git clone https://${BITBUCKET_USER}:${BITBUCKET_PASS}@${BITBUCKET_HOST}/scm/kub/$REPO.git
   if [ ! -d $REPO ]; then
    git clone https://${BITBUCKET_USER}:${BITBUCKET_PASS}@${BITBUCKET_HOST}/scm/kub/$REPO.git
  else
    printf "[INFO] $REPO\n"
    cd $REPO
    git pull
    cd - > /dev/null
  fi
done
done
</source>
</source>

Latest revision as of 00:24, 2 November 2021

Download all repositories from Bitbucket Server over https and basic auth

#!/bin/bash

REPOS=(
repo1
repo2
)

for REPO in ${REPOS[@]}; do
  if [ ! -d $REPO ]; then 
    git clone https://${BITBUCKET_USER}:${BITBUCKET_PASS}@${BITBUCKET_HOST}/scm/kub/$REPO.git
  else
    printf "[INFO] $REPO\n"
    cd $REPO
    git pull
    cd - > /dev/null
  fi
done