79

I'm wondering how you can sync your Postman config with a git repository.

I know you can export and import from Postman to a folder - which is OK - but I wondered if there was something more effortless.

meh-uk
  • 2,031
  • 1
  • 23
  • 36
  • 2
    Your question was the answer I was looking for: I didn't know about Postman's export/import features. Now that I knew to look for them, I found that they suit my purposes. Thanks! – Dan H Jun 14 '18 at 21:42
  • 4
    It’s worth noting that Postman exports pretty cleanly to git (or another source control) these days. – meh-uk Jun 17 '18 at 10:18
  • 17
    This cloud stuff is the main reason why we aren't currently using Postman. We'd even pay a reasonable amount for it if we could simply save it to our repo. – Joe Phillips Jun 17 '19 at 15:21
  • 2
    We don’t pay and use our own repo and export/import as required. It works fine. I’d happily pay $5/user/year for something better but currently it is too expensive. – meh-uk Jun 18 '19 at 16:04
  • 3
    @JoePhillips Same for us...that's why we start using Insomnia as you can load/save as in a normal program. (Not affiliated to Insomnia in any way - just a software architect in search for Graal) – Alex Jun 28 '22 at 14:02

5 Answers5

25

I'm not exactly sure how you're trying to use this, but a few options would be:

First Option

to use their addon cli called newman. You can run collections from a URL or Local file with newman using

newman run http://some.url.here

Then if you make the remote url a part of a git repository it would obviously update/change with each commit/pull

Second Option

Try this with extreme caution and only if you feel comfortable with the process, also this may not be compliant with their terms of use so I don't suggest you try it without first some research

If you can find the directory in which the Postman collections are held, you could create a hard link with the command line from a git repository on your machine to the directory or specific file you need to link. Whenever you change the source file the one in the Postman config will change.

The way in which you accomplish this will depend on the system you use and version of Postman.

DanielC
  • 921
  • 7
  • 12
  • 2
    Looks like Postman stores the files locally in a database as per - https://github.com/postmanlabs/postman-app-support/issues/495 – meh-uk Dec 12 '16 at 22:58
  • 2
    This functionality will only update the json, Sync can be done only by `https://learning.getpostman.com/docs/postman/collections/version-control-for-collections/` as mentioned by @J.Lin – Bharathan Kumaran Jan 28 '20 at 03:25
18

In addition to exporting and cloud syncing as mentioned in the other answers, there's some other options too.

Postman added a Git sync in Postman app v9 so you can manage version control with forking, merging, and pull requests.

  • There are also built-in integrations to sync your Postman collections with GitHub, with GitLab, and other services for version control. These integrations are for users on the paid plans.
  • Postman also has an API so you can GET and run the latest version of your collection, environment, or whatever using Newman or continuous integration tools or to build your own integration.
J.Lin
  • 1,120
  • 9
  • 11
2

Postman is not designed for that case. They offer a cloud service which keeps you and your collaborators in sync. You can try their cloud plan for 30 days for free. Check here: https://www.getpostman.com/cloud_trial_faq

Sergej Lopatkin
  • 1,071
  • 9
  • 11
  • 14
    I just export and beautify the file before committing. It's just JSON. And free. – Triynko May 28 '20 at 16:49
  • 14
    not designed for that use-case? I think you mean postman is intentionally designed to make normal version control difficult so that eventually you'd rather just pay to use theirs. – DanO Jul 16 '21 at 23:00
  • ^^^ bingo! You can't make money if you don't artificially shoehorn users into using their system at the expense of your normal version control – Christopher Thomas Oct 09 '21 at 04:05
2

You can use Postman integrations (Home > Integrations) to link Postman to your remote git repository.

The following article explains how to integrate your gitlab repo to Postman: https://learning.postman.com/docs/integrations/available-integrations/gitlab/

Also you can use Postman API versionning to do something similar: https://learning.postman.com/docs/designing-and-developing-your-api/versioning-an-api/

elkolotfi
  • 5,645
  • 2
  • 15
  • 19
1

For non-free plans, Postman now (version 9 and up) supports automatic sync of collections with a git repository on several popular git services.

(Again, it's currently only available for paid plans)

See the documentation for how to integrate Postman with GitHub, GitLab and Bitbucket.

The process is roughly:

  • create a dedicated repo on your git provider (e.g. my-postman-collections-repo)
  • create a personal access token for the provider (e.g. GitHub) with the expected scope (e.g. repo and user)
  • define an integration (using postman UI) for each collection you want to be kept in sync

I'm working with the GitHub integration and it works great.

Gilad Bar Orion
  • 543
  • 6
  • 14
  • All of this is only available in the enterprise edition which is $99/user/month. Personally I’d find that a lot of money to get signed off. – meh-uk May 09 '22 at 14:07
  • 1
    @meh-uk, I indeed have enterprise plan. And indeed it looks like the free plans does not support those integrations. But from the documentation it looks like *all* paid plans do include integrations (e.g. 10 "integrations" for the basic plan). – Gilad Bar Orion May 10 '22 at 18:18
  • Ah fair enough – meh-uk May 11 '22 at 19:21
  • Edited my answer to reflect it's only relevant for paid plans, as you've pointed out. – Gilad Bar Orion May 23 '22 at 06:14