同步GIT:refspec的格式师傅不匹配任何 [英] Syncing GIT : refspec master does not match any

查看:620
本文介绍了同步GIT:refspec的格式师傅不匹配任何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得一些GIT的宝库同步编辑与我们的。由于这些项目来来去去,我决定创建我为了与一个crontab调用preform脚本一个单一的脚本。

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.

我的bash脚本:

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:$3cret@bitbucket.org/external/$i.git
                pushd $i
                git remote rename origin external_developer
                git remote add origin http://APIUser:P@s$w0rd@repo.ourdomain.com/scm/git/$REPO
                git push origin master
                popd
        fi
done

一切顺利完美,直到git的一部分。这克隆的作品。远程重命名工作远程添加工作,但是混帐推给我一个错误:

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@s$w0rd@repo.ourdomain.com/scm/git/EXTERNAL-REPO-Projectx' 

此错误意味着主机不存在外部吧?但据我所知它确实存在。我也读过:
<一href=\"http://stackoverflow.com/questions/5181845/git-push-existing-repo-to-a-new-and-different-remote-repo-server\">Git推动现有回购到一个新的和不同的远程服务器回购?

新库按产地主误差

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

这之后,我做了一些更多的研究Git和我盘算了一下,外部使用命名发展及主要只是初始提交的分支。

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.

我是不是做一些巨大的Git的错误?我怎样才能解决这个问题,或者有更好的方式来同步2控释片?

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.

因此​​,我读过:
<一href=\"http://stackoverflow.com/questions/4181861/src-refspec-master-does-not-match-any-when-pushing-commits-in-git\">src refspec的格式主机不匹配的git 任何按下时提交

<一href=\"http://stackoverflow.com/questions/10568641/git-error-src-refspec-master-does-not-match-any\">git:错误:SRC refspec的格式师傅不匹配任何

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

推荐答案

这个问题解决了,外线没有一个主分支。只有发展分支。

The issue is resolved, the external party did not have a master branch. Only a develop branch.

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 develop
                popd
        else
                git clone https://extern_u:$3cret@bitbucket.org/external/$i.git
                pushd $i
                git remote rename origin external_developer
                git remote add origin http://APIUser:P@s$w0rd@repo.ourdomain.com/scm/git/$REPO
                git push origin develop
                popd
        fi
done

这篇关于同步GIT:refspec的格式师傅不匹配任何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆