ARMmbed

Import using cli not working for me

Hi,
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 https://os.mbed.com/teams/AnalogDevices/code/testRepo/
Cloning into ‘C:\Firmware\testMbed\testRepo’…
fatal: unable to access ‘https://os.mbed.com/teams/AnalogDevices/code/testRepo/’: 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 mbed.com 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 https://os.mbed.com/teams/AnalogDevices/code/testRepo/ -vv                                                                                                    255 ↵
[mbed-96897] Working path "/Users/ausbla01/Downloads" (directory)
[mbed-96897] Importing program "testRepo" from "https://os.mbed.com/teams/AnalogDevices/code/testRepo" 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 https://os.mbed.com/teams/AnalogDevices/code/testRepo /Users/ausbla01/Downloads/testRepo -v" in "/Users/ausbla01/Downloads"
Cloning into '/Users/ausbla01/Downloads/testRepo'...
fatal: unable to access 'https://os.mbed.com/teams/AnalogDevices/code/testRepo/': The requested URL returned error: 403
[mbed-96897] Exec "hg clone https://os.mbed.com/teams/AnalogDevices/code/testRepo /Users/ausbla01/Downloads/testRepo -v" in "/Users/ausbla01/Downloads"
http authorization required for https://os.mbed.com/teams/AnalogDevices/code/testRepo/
realm: mbed.org
user: USERNAME HERE
password: PASSWORDHERE

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.