1

I am trying to configure autopush to the branch dev in github, using CircleCi. The problem is that I get an error like:

"error: src refspec dev does not match any.
error: failed to push some refs to 'git@github.com:myname/repo.git'.
Exited with code 1".

When I am using git remote -v, I can see:

origin  git@github.com:myname/repo.git (fetch)
origin  git@github.com:myname/repo.git (push)

And on the github required branch "dev" exists. Below you can see the part of my *yml code for CircleCi that makes everything.

  - run:
      name: Git config email
      command: git config --global user.email "name@mail.ru"
  - run: 
      name: Git config name
      command: git config --global user.name "Name"
  - run:
      name: git remote -v
      command: git remote -v
  - run:
      name: Push to dev
      command: git push origin dev --force
marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
NikSer
  • 11
  • 2
  • Also, i thoung, thet the problem is lack of commit, but i also tried: `add . git commit -m "Commit to dev"` And the resul was: **On branch my_branch nothing to commit, working tree clean Exited with code 1** – NikSer Aug 12 '19 at 15:30
  • When i am trying to `git show-ref`, i can see next: `8ab8123caee6ea99b34bb8fdac4e626ec20e43ac refs/heads/my_branch 8ab8123caee6ea99b34bb8fdac4e626ec20e43ac refs/heads/master 6d629cafb48677bb598f9d24e87654fd2b8dff8c refs/remotes/origin/HEAD 8ab8123caee6ea99b34bb8fdac4e626ec20e43ac refs/remotes/origin/my_branch 4a16ca86e21710df72b5b7405502b59850428484 refs/remotes/origin/dev 6d629cafb48677bb598f9d24e87654fd2b8dff8c refs/remotes/origin/master` So, here is nothing like refs/heads/dev, how can i add it? – NikSer Aug 12 '19 at 16:17
  • made `git checkout dev` and `refs/heads/dev ` appeared, but the command `git push origin dev` do not pushed changes into git branch "dev". – NikSer Aug 12 '19 at 16:42

1 Answers1

0

git checkout dev and refs/heads/dev appeared, but the command git push origin dev do not pushed changes into git branch "dev".

That would create a local dev branch based by default on origin/dev.

You would need to merge my_branch to dev first before pushing

git merge my_branch
git push

(git push should be enough, since the newly local created branch dev has origin/dev for its upstream branch)

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283