Push to another branch on github

I want to push the commited branch to another automaticly by using config.yml. The problem is that recieve error like:

fatal: ‘origin/dev’ does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Exited with code 128

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.

  - 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

The command:

git checkout dev
git merge origin/commited_branch 

worked good, but i dont want to hardcode the name of the branch, just want to push every new commit in every branch (excluding branches “dev” and “master”) to the branch “dev”. Is it possible?

I also thought that the problem is about the key, and tried like this:

GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -F /dev/null" git push origin/dev

But the result is the same.

And if I use command:

git push origin dev

I have an error:

error: src refspec dev does not match any.
error: failed to push some refs to ‘git@github.com:myName/myRepo.git’
Exited with code 1

git show-ref shows me next:

1 Like

Did you figure this out? We always had jenkins check for branches prefixed with “submit_*****” and only build those branches by “git checkout {branchname}”, then “git merge master”, then “./gradlew build” and finally if all 3 of those passed, we would then run “git checkout master” and “git merge {branchname}” to complete the cycle so that master was always a working build. Trying to see if we can do that with circle ci or if we just install jenkins on a server computer instead.