zoukankan      html  css  js  c++  java
  • git 远程自动打tag

    rm -rf *
    git reset --hard && git clean -fdx
    
    #git init
    git config --global http.sslVerify false 
    #对IFS变量 进行替换处理
    OLD_IFS="$IFS"
    IFS="@"
    array=($gitUrl)
    IFS="$OLD_IFS"
    for i in ${array[*]};do
    	gitUrl=$i
    done
    echo $gitUrl
    git config http.postBuffer 524288000
    gitUrl=${gitUrl/://} git clone -b $branch https://$username:$password@$gitUrl #以git开头的url,截取@符号后面的内容,:替换成/ git tag -d $tagName || git push $branch :refs/tags/$tagName || echo "清理tag" #创建tag git tag -a $tagName -m "$comment" sshpass -p $password git push $branch ${tagName}

      

      • expect远程提交tag
        #提交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
        

          最终最完善版本,gitUrl必须是https开头的那个地址,不是git开头的地址

        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}

          python版代码,增加了报错邮件发送和错误校验

        11
        

          

  • 相关阅读:
    努力努力,我假期要练琴学css
    在遇到困难时我们都会想要是这一切不曾发生该多好,可现实并不以我们的意志为转移,我们所能做的就是去克服...
    寒假学习目标~
    平安夜&&圣诞节
    you are the ont that we would like to trust and ca...
    Happy New Year!PR升3啦!
    呵呵,Merry Christmas & Happy New Year!
    使用Rx Framework实现XAML中的物体拖动
    MVVM绑定多层级数据到TreeView并设置项目展开
    Entity framework中EntityFunctions.CreateDateTime方法的闰年闰月bug
  • 原文地址:https://www.cnblogs.com/slqt/p/13602227.html
Copyright © 2011-2022 走看看