# Github deployments trigger bad cloning stage

**URL:** <https://drone.discourse.group/t/github-deployments-trigger-bad-cloning-stage/7671>\
**Category:** Drone Bugs\
**Created:** [December 2, 2019, 4:05am UTC](https://drone.discourse.group/t/github-deployments-trigger-bad-cloning-stage/7671 "2019-12-02T04:05:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![carash](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@carash](https://drone.discourse.group/u/carash)\
**Post date:** [December 2, 2019, 4:05am UTC](https://drone.discourse.group/t/github-deployments-trigger-bad-cloning-stage/7671/1 "2019-12-02T04:05:09Z")

</div>

I have a simple pipeline that is triggered by a deployment event in github. When it gets to the cloning stage, it always fails since it tries to clone from a weird ref.

```auto
kind: pipeline
type: docker
name: testing

steps:
- name: test
  image: busybox
  commands:
  - printenv

trigger:
  event:
  - promote
  target:
  - production

```

Drone always tries to append a `refs/heads/` to the ref sent by the event when it is should just be the commit SHA.

```bash
curl -X POST \
  https://api.github.com/repos/ ***/*** /deployments \
  -H 'Authorization: Basic *************************************' \
  -H 'Content-Type: application/json' \
  -d '{
  "ref": " ************************************* 145",
  "auto_merge": false
}'

```

```auto
Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/ ************************************* 145:
fatal: Couldn't find remote ref refs/heads/ ************************************* 145

```

even when trying to use a head of a branch as a trigger, it still appends a `refs/heads/` to the head ref, failing the cloning stage

```bash
curl -X POST \
  https://api.github.com/repos/ ***/*** /deployments \
  -H 'Authorization: Basic *************************************' \
  -H 'Content-Type: application/json' \
  -d '{
  "ref": "refs/heads/test-triggers",
  "auto_merge": false
}'

```

```auto
Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/refs/heads/test-triggers:
fatal: Couldn't find remote ref refs/heads/refs/heads/test-triggers

```
