File bin/modules/sshpush.sh

Last commit: Mon Dec 9 22:20:18 2024 +0100	Jan Dankert	Fix: removed hard coded hostnames :-O
1 #!/bin/bash 2 3 echo "Pushing repository '$REPO_NAME' to '${ssh_host}'" 4 5 # no commits? No action. 6 if [ $(git rev-list --count --all) == "0" ]; then 7 echo "Warning: There are no commits in this repository, unable to push" 8 return 0 9 fi 10 11 # Check if remote repo exists 12 if (ssh ${ssh_user}@${ssh_host} "[ ! -d ${ssh_path}/${REPO_NAME}.git ]"); then 13 echo "Repository does not exist. Creating a new remote bare repository ..." 14 ssh ${ssh_user}@${ssh_host} "mkdir ${ssh_path}/${REPO_NAME}.git;cd ${ssh_path}/${REPO_NAME}.git; git init --bare" 15 fi 16 17 # Push to remote repos 18 echo "Pushing to remote repository as user '${ssh_user}' to '${ssh_host}:${ssh_path}/${REPO_NAME}'" 19 git push --all ${ssh_user}@${ssh_host}:${ssh_path}/${REPO_NAME} 20 git push --tags ${ssh_user}@${ssh_host}:${ssh_path}/${REPO_NAME} 21 22 # Updating serverinfo for HTTP pulls 23 echo "Updating serverinfo ..." 24 ssh ${ssh_user}@${ssh_host} "cd ${ssh_path}/${REPO_NAME}.git; git update-server-info"
Download bin/modules/sshpush.sh
History Mon, 9 Dec 2024 22:20:18 +0100 Jan Dankert Fix: removed hard coded hostnames :-O Sun, 12 May 2024 19:53:02 +0200 Jan Dankert first edition of DIT, the delivery expert.