<p>I recently ran into the same error. In my case, I had rebased a branch and was attempting to push to the remote. One of the pulled commits had changed the structure of a few directories, and git refused to push after the rebase, throwing:</p>

<pre><code>fatal: ambiguous argument 'path/to/scripts': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git &lt;command&gt; [&lt;revision&gt;...] -- [&lt;file&gt;...]'
Cannot open directory /absolute/path/to/scripts: No such file or directory
error: failed to push some refs to 'git@host:repo'
</code></pre>

<p>I tore apart all of my git configs and could not find the cause of this anywhere. The culprit turned out to be a pre-push git hook, left over from some previous config we used to use, which included some operations on the now-defunct directory.</p>

<p>While this clearly wasn't the cause of the OP's issue, thought I'd post this here in case someone else gets bitten. Beware the git hooks...</p>

CC BY-SA 3.0
2018-03-20T19:47:22.173Z
2018-03-20T19:47:22.173Z
Criminally Inane
<p>The error looks like you're using a non-existent reference (branch/tag). Try specifying the correct branch and tag using the <code>branch/tag</code> options. You can also use the commit hash directly using <code>ref</code> option. </p>

<p>Also ensure that your git URL is correct (your code does not contain the xxx.git part).</p>

CC BY-SA 3.0
2017-05-04T14:01:26.057Z
yes you are right. I used undefined tag so I received that error. giving a correct tag helped to solve this. Thanks @grumpyops
pandey
CC BY-SA 3.0
2017-05-04T08:03:52.497Z
2017-05-04T08:03:52.497Z
grumpyops
<p>when I modified one of my cookbook that I tried to add a cookbook dependency in berks file</p>

<pre><code>cookbook name, '=0.1.0', git: 'ssh://url:xxx/cookbook', tag: '0.0.1'
</code></pre>

<p>and then tried to converge it which throws an error </p>

<pre><code>'fatal: ambiguous argument 'master': unknown revision or path not in the working tree.use '--' to separate paths from revisions, like this:git &lt;command&gt; [&lt;revision&gt;...] -- [&lt;file&gt;...]'on test
</code></pre>

<p>I don't have much clue to explain even..but I can post my explanation as we go. I appreciate your help thank you</p>

<git><chef><gitlab><github>
fatal: ambiguous argument 'master': unknown revision or path not in the working tree
pandey
# fatal: ambiguous argument 'master': unknown revision or path not in the working tree

(Asked by: username_0 on 2017-05-03)

when I modified one of my cookbook that I tried to add a cookbook dependency in berks file
cookbook name, '=0.1.0', git: 'ssh://url:xxx/cookbook', tag: '0.0.1'

and then tried to converge it which throws an error 
'fatal: ambiguous argument 'master': unknown revision or path not in the working tree.use '--' to separate paths from revisions, like this:git  [...] -- [...]'on test

I don't have much clue to explain even..but I can post my explanation as we go. I appreciate your help thank you

**Tags:** git, chef, gitlab, github


---

## 2 answers

### Answer by username_2 on 2017-05-04. Score: 5 | Accepted answer

The error looks like you're using a non-existent reference (branch/tag). Try specifying the correct branch and tag using the `branch/tag` options. You can also use the commit hash directly using `ref` option.

Also ensure that your git URL is correct (your code does not contain the xxx.git part).

> **Comments:**
> **username_0**: yes you are right. I used undefined tag so I received that error. giving a correct tag helped to solve this. Thanks @username_2  

---

### Answer by username_1 on 2018-03-20. Score: 3

I recently ran into the same error. In my case, I had rebased a branch and was attempting to push to the remote. One of the pulled commits had changed the structure of a few directories, and git refused to push after the rebase, throwing:
fatal: ambiguous argument 'path/to/scripts': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git  [...] -- [...]'
Cannot open directory /absolute/path/to/scripts: No such file or directory
error: failed to push some refs to 'git@host:repo'

I tore apart all of my git configs and could not find the cause of this anywhere. The culprit turned out to be a pre-push git hook, left over from some previous config we used to use, which included some operations on the now-defunct directory.
While this clearly wasn't the cause of the OP's issue, thought I'd post this here in case someone else gets bitten. Beware the git hooks...


---

