# Postman CLI Publish API Error: Unable to find a Git branch connected to this API

**URL:** <https://community.postman.com/t/postman-cli-publish-api-error-unable-to-find-a-git-branch-connected-to-this-api/76605>\
**Category:** API Pulse\
**Tags:** api-documentation, api, postman-api, cli, postman-cli\
**Created:** [March 7, 2025, 6:44pm UTC](https://community.postman.com/t/postman-cli-publish-api-error-unable-to-find-a-git-branch-connected-to-this-api/76605 "2025-03-07T18:44:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhillamwins](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@jhillamwins](https://community.postman.com/u/jhillamwins)\
**Post date:** [March 7, 2025, 6:44pm UTC](https://community.postman.com/t/postman-cli-publish-api-error-unable-to-find-a-git-branch-connected-to-this-api/76605/1 "2025-03-07T18:44:19Z")

</div>

I have an API set up with Postman Teams, connected to a GitHub repository. I can publish the API without issues using the Postman desktop app. However, I’m encountering difficulties when trying to publish the API via the Postman CLI.

Here’s what I do:

1. Clone the GitHub repository to my local machine outside of Postman.
2. Run the following command at the root folder of the git repo:

```auto
postman api publish [api id] --name v1 --release-notes "Demo release notes" --api-definition "C:\Users\x\source\repos\github\x\apis\openapi\index.json"

```

The command starts with “Fetching contents to publish” but immediately fails and returns

> The system cannot find the path specified.
> 
> Error: Unable to find a git branch connected to this API. Try running the command again with correct git repository folder or CI pipeline.

---

<div class="post-metadata">

**Author:** ![jatin-postman](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@jatin-postman](https://community.postman.com/u/jatin-postman)\
**Post date:** [March 12, 2025, 1:15pm UTC](https://community.postman.com/t/postman-cli-publish-api-error-unable-to-find-a-git-branch-connected-to-this-api/76605/2 "2025-03-12T13:15:51Z")

</div>

Hi Jeremy,

The error you shared above gets raised in 2 scenarios:

1. If running in a CI pipeline, we are not able to identify the correct branch from Environment variables
2. If running on a machine manually and we are not able to identify the branch using `git` cli

So, I just want to verify once:  
On the local machine where you are running the postman-cli command, do you have the `git` cli installed as well?  
For example, if you run `git --version` on the terminal, do you get a valid output?

---

<div class="post-metadata">

**Author:** ![jhillamwins](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@jhillamwins](https://community.postman.com/u/jhillamwins)\
**Post date:** [March 12, 2025, 2:45pm UTC](https://community.postman.com/t/postman-cli-publish-api-error-unable-to-find-a-git-branch-connected-to-this-api/76605/3 "2025-03-12T14:45:59Z")

</div>

Sure. I have the repo cloned and git cli running fine in the directory.

 ![](https://us1.discourse-cdn.com/getpostman/original/3X/6/b/6bbbdf2dd4835e978233fa0b81e1be48ec4ce66f.png)

---

<div class="post-metadata">

**Author:** ![jatin-postman](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@jatin-postman](https://community.postman.com/u/jatin-postman)\
**Post date:** [May 13, 2025, 4:38am UTC](https://community.postman.com/t/postman-cli-publish-api-error-unable-to-find-a-git-branch-connected-to-this-api/76605/4 "2025-05-13T04:38:03Z")

</div>

We have released a new version of the **postman-cli:**  **1.14.0** that should solve all the windows related issues.
