I am trying to get a number of GIT repositories sync-ed with ours. As these projects come and go I decided to create one single script that I call with a CronTab in order to preform the script.
I did try this by hand and it did work, however with these other repositories it did not.
My Bash Script:
external_repos=( "OurName.projectx" "OurName.anotherproject" "OurName.thirdproject" "OurName.stackexchange" ) for i in "${external_repos[@]}" do echo "Handling" $i TEMP=`echo $i | cut -d "." -f 2` TEMP="${TEMP^}" REPO="EXTERNAL-REPO-$TEMP" # printf "Temp : %s\n" $TEMP # printf "Repo : %s\n" $REPO if [ -d "$i" ]; then pushd $i git pull external_developer develop && git push origin master popd else git clone https://extern_u:[email protected]/external/$i.git pushd $i git remote rename origin external_developer git remote add origin http://APIUser:P@[email protected]/scm/git/$REPO git push origin master popd fi done Everything goes perfectly, till the git part.. Cloning works. remote rename works remote add works but the git push gives me an error:
error: src refspec master does not match any. error: failed to push some refs to 'http:http://APIUser:P@[email protected]/scm/git/EXTERNAL-REPO-Projectx' This error means that master does not exist external right? But as far as I know it does exist. Also I've read: Git push existing repo to a new and different remote repo server? and Push origin master error on new repository
After this I did some more research into git and I figured that the externals use a branch named develop and main is just for the initial commit.
Am I making some huge Git Error? How can I fix this issue or is there a better way to Sync two gits?
Before I forget: I tried to add all and I tried a commit before.
Thus I've read: src refspec master does not match any when pushing commits in git and git: error: src refspec master does not match any