将 gitlab 仓库代码推送到 Google 源仓库
Push gitlab repository code to Google source repository
我按照下面的文章将 gitlab 存储库代码推送到 Google 云源存储库,但我收到此命令的错误
git push -f google master
error: src refspec master does not match any.
error: failed to push some refs to 'https://source.developers.google.com/p/project/r/test/'
文章如下:
https://medium.com/@bamnet/cloud-source-repositories-gitlab-2fdcf1a8e50c
有什么,我做错了吗?关于如何避免此错误消息的任何想法?
src refspec master does not match any
问题是您关注的文章的日期:2018 年 8 月。
GitLab Runner 从那时起发生了变化,更准确地说是在 2019 年 5 月。
2019 年 5 月 this thread 中描述的问题:
Since we are using refspec to clone/fetch the repository, we checkout a specific commit and not checking out a specific branch.
When the script does git push master
, the branch is nowhere to be found so git doesn’t know what to push.
那是因为,在 GitLab 方面,MR 1203:
Basically, GitLab CE/EE sends refspecs parameter to GitLab Runner gitlab-org/gitlab-foss
app/presenters/ci/build_runner_presenter.rb
: this parameter is to used in GitLab Runners for fetching branch/tag refs from remote repository.
This change was introduced because we wanted GitLab Rails side to leverage respecs in order for issue 7380 "Combined ref pipelines (source+target branch)" though, there should not be a big difference between git clone $URL
or mkdir $REPO_DIR && git remote add origin $URL && git fetch +refs/heads/branch_name:refs/remotes/origin/branch_name
.
In fact, the new behavior has already run on our development project
https://gitlab.com/gitlab-org/gitlab-ce/pipelines and has no issues so far.
Issue 4097当时打开
Workaround
Use HEAD when you want to push this to another remote.
deploy:
stage: deploy
script:
- git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/<project>.git
- git push -f heroku HEAD:master
所以不要勉强master
。推头。
OP Adam 使用另一种解决方法并添加:
before_script:
- git checkout master
我按照下面的文章将 gitlab 存储库代码推送到 Google 云源存储库,但我收到此命令的错误
git push -f google master
error: src refspec master does not match any.
error: failed to push some refs to 'https://source.developers.google.com/p/project/r/test/'
文章如下: https://medium.com/@bamnet/cloud-source-repositories-gitlab-2fdcf1a8e50c
有什么,我做错了吗?关于如何避免此错误消息的任何想法?
src refspec master does not match any
问题是您关注的文章的日期:2018 年 8 月。
GitLab Runner 从那时起发生了变化,更准确地说是在 2019 年 5 月。
2019 年 5 月 this thread 中描述的问题:
Since we are using refspec to clone/fetch the repository, we checkout a specific commit and not checking out a specific branch.
When the script doesgit push master
, the branch is nowhere to be found so git doesn’t know what to push.
那是因为,在 GitLab 方面,MR 1203:
Basically, GitLab CE/EE sends refspecs parameter to GitLab Runner
gitlab-org/gitlab-foss
app/presenters/ci/build_runner_presenter.rb
: this parameter is to used in GitLab Runners for fetching branch/tag refs from remote repository.This change was introduced because we wanted GitLab Rails side to leverage respecs in order for issue 7380 "Combined ref pipelines (source+target branch)" though, there should not be a big difference between
git clone $URL
ormkdir $REPO_DIR && git remote add origin $URL && git fetch +refs/heads/branch_name:refs/remotes/origin/branch_name
.
In fact, the new behavior has already run on our development project https://gitlab.com/gitlab-org/gitlab-ce/pipelines and has no issues so far.
Issue 4097当时打开
Workaround
Use HEAD when you want to push this to another remote.
deploy:
stage: deploy
script:
- git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/<project>.git
- git push -f heroku HEAD:master
所以不要勉强master
。推头。
OP Adam 使用另一种解决方法并添加:
before_script:
- git checkout master