Create Mirror
With SSH URL:
# when hostkey check is off
git -c "core.sshCommand=ssh -i <PRIVATE_KEY_FILE> -o StrictHostKeyChecking=no" clone --mirror [email protected] <LOCAL_PATH>
# when hostkey check is on
git -c "core.sshCommand=ssh -i <PRIVATE_KEY_FILE> -o StrictHostKeyChecking=yes -o UserKnownHostsFile=<KNOWN_HOSTS_FILE>" clone --mirror [email protected] <LOCAL_PATH>
With HTTP/HTTPS URL:
# when SSL verification is on
git clone --mirror https://USER_NAME:PASSWORD@URL <LOCAL_PATH>
# when SSL verification is off
git -c http.sslVerify=false clone --mirror https://USER_NAME:PASSWORD@URL <LOCAL_PATH>
Update Mirror
With SSH URL:
# without hostkey
git -c "core.sshCommand=ssh -i <PRIVATE_KEY_FILE> -o StrictHostKeyChecking=no" fetch origin
# with hostkey
git -c "core.sshCommand=ssh -i <PRIVATE_KEY_FILE> -o StrictHostKeyChecking=yes -o UserKnownHostsFile=<KNOWN_HOSTS_FILE>" fetch origin
With HTTP/HTTPS URL:
git remote set-url origin http://USERNAME:PASSWORD@URL
git fetch origin
# if sslVerify is enabled for https
# git -c http.sslVerify=false fetch origin