#提交tag
dateTime=`date -d "now" +%Y%m%d`
tagName="RT-V2.0.$version.$dateTime"
git tag -a $tagName -m "$comment"
/usr/bin/expect<<EOF
set timeout 30
spawn git push origin ${tagName}
expect {
"Username for 'https://git.uyunsoft.cn':" { send "$username\r" }
"Password for 'https://$username@git.uyunsoft.cn':" { send "$password\r" }
}
expect "Password for 'https://$username@git.uyunsoft.cn':" { send "$password\r" }
expect eof
EOF
rm -rf *
rm -rf .git
git reset --hard && git clean -fdx
git init
git config --global http.sslVerify false
git config http.postBuffer 524288000
#branch=${branch##*/}
branch=${branch#origin/}
gitUrl_real=$gitUrl
gitUrl=${gitUrl##*:}
gitUrl=`echo ${gitUrl:2}`
gitUrl="https://$username:$password@$gitUrl"
git remote add $branch $gitUrl
dateTime=`date -d "now" +%Y%m%d`
tagName="RT-V2.0.$version.$dateTime"
git tag -d $tagName ||
git push $branch :refs/tags/$tagName ||
echo "清理指定分支的tag"
#创建tag
git fetch --tags --progress --quiet -- $gitUrl +refs/heads/*:refs/remotes/origin/* 2>&1
remote_branch=`git branch -r|grep "origin/$branch$"`
echo $remote_branch
#if [ $remote_branch == "" ];then
#remote_branch=`git branch -r|grep "$branch$"`
#endif
head=`git rev-parse $remote_branch`
git checkout -f $head
git branch -a -v --no-abbrev
git checkout -b $branch $head
git tag -a $tagName -m "$comment"
sshpass -p $password git push $branch ${tagName}