Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • gitlab-runner gitlab-runner
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 3,459
    • Issues 3,459
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 109
    • Merge requests 109
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • gitlab-runnergitlab-runner
  • Issues
  • #4097
Closed
Open
Issue created Mar 28, 2019 by Steve Azzopardi@steveazzMaintainer

Branch is no longer checked out when using refspec

Summary

Original discussion started in https://forum.gitlab.com/t/src-refspec-master-does-not-match-any/24691 all the jobs that were posted was because they are trying to push a specific branch. Using refspec we don't check out a branch but checkout a specific commit.

Steps to reproduce

Have a job trying to push master

deploy:
  stage: deploy
  script:
  - git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/<project>.git && git push -f heroku master
  environment:
    name: production
    url: https://<project>.herokuapp.com
  only:
  - master

Actual behavior

A user would get the error Src refspec master does not match any

Expected behavior

The user can push master to any remote.

Relevant logs and/or screenshots

A job running git branch as part of the script.

  • Runner 11.9
  • Runner 11.8

Used GitLab Runner version

11.9

Regression most likely introduced in !1203 (merged)

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

Wont Fix ⚠

At first, we were implementing !1270 (merged) as a fix but decided to revert it in !1283 (merged) since it had some bad performance regressions. The behavior we had was flaky at best for the following reasons described in #4097 (comment 156508723)

/cc @nolith @tmaczukin @erushton

Edited Apr 02, 2019 by Steve Azzopardi
Assignee
Assign to
Time tracking