Import using cli not working for me

I am testing the mbed-cli tools and cannot work out how to import a project i have created. I have a test project here, i am assuming that i can clone it to my local machine, add some file and then push the code back.
When i try mbed import or mbed add (it’s not obvious what the difference is between the two), i get errors. The repo is private - but i’m happy to create a public one if necessary.

abort: http authorization required for
Cloning into ‘C:\Firmware\testMbed\testRepo’…
fatal: unable to access ‘’: The requested URL returned error: 403

Ultimately, i have mbed code written, and i want to upload it to an mbed-hosted repo, as part of this repo i want to include the mbed-os-lib (how is this done?). I can’t even get the empty repo to clone on my machine - what am i missing?

Hi, you will need to do 2 things

  1. make sure you have mercurial installed on your machine (pip install mercurial) as uses mercurial to host code
  2. try running mbed import with the -vv option, it should prompt you for your username / password and use those

example output:

╰─➤  mbed import -vv                                                                                                    255 ↵
[mbed-96897] Working path "/Users/ausbla01/Downloads" (directory)
[mbed-96897] Importing program "testRepo" from "" at latest revision in the current branch
[mbed-96897] Trying to guess source control management tool. Supported SCMs: bld, git, hg
[mbed-96897] Exec "git clone /Users/ausbla01/Downloads/testRepo -v" in "/Users/ausbla01/Downloads"
Cloning into '/Users/ausbla01/Downloads/testRepo'...
fatal: unable to access '': The requested URL returned error: 403
[mbed-96897] Exec "hg clone /Users/ausbla01/Downloads/testRepo -v" in "/Users/ausbla01/Downloads"
http authorization required for

Also, for reference, ‘mbed import’ is used to pull projects from the web, it will then automatically run ‘git clone’ or ‘hg clone’ as appropriate, then ‘mbed deploy’ to pull down all the libraries.

‘mbed add’ is used to add a library to an existing project.

Thanks for the response - this helped, i had tried the -vv option but was not prompted for credentials. I typically use Cmder (mintty) and (i now know) this doesn’t work. Running standard windows cmd got me passed this.

Some questions if you don’t mind.

  • Is this process documented anywhere?
  • Following import, of a project, what is the process for pushing changes to the repo
  • Can i use normal git commands to commit/push/fetch/pull changes to the repo
  • Where can i use git - we have a git-flow in place and i’d like to avoid Mercurial where possible.
  • I used the command mbed add mbed-os.lib, following this, i get mbed-os (a directory with the full mbed-os repo in it), and i get mbed-os.lib - in my root project directory. When i push this back, how is this done to ensure that only the .lib is pushed?
  • Why Mercurial - seriously, why - it’s even hard to spell!

Thanks again - it’s difficult finding people that understand this stuff.

@ssmith73 -* uses mercurial,* uses git. I personally run most of my projects out of github these days, so i can use git. If you want to host code on* then you’ll have to use mercurial.

After you’ve imported a program you can make changes just as you would with any other git or mercurial repo respectively.

If you want to use git commands, just host your project on github or an equivalent service like gitlab…etc.

by default when you do a ‘mbed add …’ command what you’re doing under the covers is actually a ‘git clone …; mbed deploy’ command (or equivalent for mercurial), all you need to do is add the .lib file to your project and the next time you run mbed import it will auto deploy the files. No need to push all the source up.

~12 years ago when mbed first started mercurial was the obvious choice, ~6 years ago git became the obvious choice, just how the tech evolved, and the switching cost / backwards incompatibility is too great to switch over. Its why we now support ‘hosting’ projects on the site via github, because frankly its better and what we use for internal stuff anyway. (