# Push to another branch on github

**URL:** <https://discuss.circleci.com/t/push-to-another-branch-on-github/31880>\
**Category:** Build Environment\
**Tags:** github, circle-yml\
**Created:** [August 13, 2019, 9:35am UTC](https://discuss.circleci.com/t/push-to-another-branch-on-github/31880 "2019-08-13T09:35:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NikSerr](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/nikserr/32/22965_2.png) [@NikSerr](https://discuss.circleci.com/u/NikSerr)\
**Post date:** [August 13, 2019, 9:35am UTC](https://discuss.circleci.com/t/push-to-another-branch-on-github/31880/1 "2019-08-13T09:35:25Z")

</div>

Hello!  
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:

```auto
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.

```auto
  - 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:

```auto
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:

```auto
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:

```auto
refs/heads/commited_branch
refs/heads/master
refs/remotes/origin/HEAD
refs/remotes/origin/commited_branch
refs/remotes/origin/dev
refs/remotes/origin/master

```

---

<div class="post-metadata">

**Author:** ![deanorderly](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/deanorderly/32/25132_2.png) [@deanorderly](https://discuss.circleci.com/u/deanorderly)\
**Post date:** [March 9, 2020, 10:56pm UTC](https://discuss.circleci.com/t/push-to-another-branch-on-github/31880/2 "2020-03-09T22:56:17Z")

</div>

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.
