This commit is contained in:
2023-03-22 16:10:56 +01:00
commit fb0ff3e057
3 changed files with 45 additions and 0 deletions

9
fun.sh Normal file
View File

@@ -0,0 +1,9 @@
#! /usr/bin/env bash
#
#for branch in $(git for-each-ref --format='%(refname)' refs/heads/); do
# echo "${branch/'refs/heads/'/''}"
#done
function test() {
git for-each-ref --format='%(refname)' refs/heads/
}

33
main.sh Executable file
View File

@@ -0,0 +1,33 @@
#! /usr/bin/env bash
#for branch in $(git for-each-ref --format='%(refname)' refs/heads/); do
# echo "${branch/'refs/heads/'/''}"
#done
clone_work_dir="/home/jonnybravo/workdir"
script_folder="$(pwd)"
echo $script_folder
#create_clone_Folder
if [ ! -d $clone_work_dir ]
then
mkdir -p $clone_work_dir
fi
while IFS="," read -r git_url project_name
do
clone_folder="$clone_work_dir/$project_name"
if [ -d $clone_work_dir ]
then
echo "Verzechnis $clone_work_dir existiert bereits"
else
git clone $git_url $clone_folder
fi
cd $clone_folder
for branch in $(git for-each-ref --format='%(refname)' refs/heads/)
do
git_pro_branch="${branch/'refs/heads/'/''}"
echo "$project_name as $git_pro_branch"
done
cd $script_folder
done < <(tail -n +2 project.csv)

3
project.csv Normal file
View File

@@ -0,0 +1,3 @@
git_url,project_name,
https://gitea.schlaubistechtalk.de/t4m/docker_gitlab.git,docker_gitlab,
https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git,win_ps_hidden_files,
1 git_url project_name
2 https://gitea.schlaubistechtalk.de/t4m/docker_gitlab.git docker_gitlab
3 https://gitea.schlaubistechtalk.de/t4m/win_ps_hidden_files.git win_ps_hidden_files