I have gitolite setup on one one of my server and it has lots of git repositories. So i decided to take a back up of all these and found this about git bundle
. And based on it created the below script
#!/bin/bash
projects_dir=/home/bean/git/
backup_base_dir=/home/bean/gitbackup/
test -d ${backup_base_dir} || mkdir -p ${backup_base_dir}
pushd $projects_dir
for repo in `find $projects_dir -type d -name .git`; do
cd $repo/..
this_repo=`basename $PWD`
git bundle create ${backup_base_dir}/${this_repo}.bundle --all
cd -
done
popd
cd $backup_base_dir
rsync -r . username@ip_address:/home/bean1/git_2nd_backup
In the above script 1st i am taking a backup of the repository in the same machine but in different folder as mentioned in the script backup_base_dir=/home/bean/gitbackup/
and then using rsync
taking the backup in another machine/server. So my question is, is there any way to avoid the backing up in the same machine and i can directly backup to another server/machine. Just wanted to eliminate the backing up in same machine and wanted to backup directly to server machine.
Both the machines/servers are Ubuntu 16