Report
9 months, 3 weeks ago.

No option to add repository

When I go to the code page, there is no option to add a repository (I am at https.os.mbed.com/code). Why would that be?

Question relating to:

Comment on this question

3 Answers

9 months, 3 weeks ago.

Hi Jim,

You can either share a repo that is hosted on Github, or create an Mbed-hosted repo. To share a repo on behalf of a team, the only option at the moment is to create an Mbed-hosted repo.

To add a Github repo:

  1. Go to your account profile page (from the top right corner of the page, click your username and then select Profile).
  2. Select the Code tab.
  3. Click Add Github repository and enter the repo details. If you haven't already linked your Github account to your Mbed account, you will be prompted to do so.

You can create an empty Mbed-hosted repo by using the above process and selecting the appropriate option, or publish your repo from the online compiler by following the steps outlined here: https://os.mbed.com/docs/v5.7/tutorials/publishing-code.html

Thanks,

Marianne

4 days, 12 hours ago.

Hi Marianne,

my question refers strictly to Mbed-hosted repo. Publishing repo from the online compiler is pretty straightforward. Just rigth click on your program and Publish.

However, what about publishing your local repo (existing only on your local computer) using Mbed CLI to Mbed-hosted repo? Is that possible? Any recommended steps to do that?

This is the scenario:

1. in your command line, go to your mbed projects workspace, let's say:

C:\mbed_projects

2. create new mbed program with command as follows

mbed new mbed-os-program

3. just for reference, add blank main.cpp file to your newly created project directory, here

C:\mbed_projects\mbed-os-program

So far, I hope it is clear enough. So how to publish it to Mbed-hosted repo using Mbed CLI?

2 days, 5 hours ago.

Hi Marcin,

Yes - this can be done. We have instructions for publishing in the Mbed CLI markdown located here:

The instructions don't cover the exact case that you are describing though, so let me break this down step by step for you:

1) Create a Mbed hosted repository from your Mbed account Code page (as you can't create a repo remotely). For this example, I created "Blinky_Umpteen" here:

2) Create the desktop project and initialize the local repo - here we're starting from a new Mbed project which is what you would like:

mbed new blinky
cd blinky/
hg init

3) Associate the local repo with the Mbed hosted one. This is covered in the CLI documents, but to summarize, you need to create a hgrc file in the ".hg" folder that was generated by "hg init" and define the repo (including your login password).

My hgrc file consists of:

[paths]
default = https://RalphF:<password>@os.mbed.com/users/RalphF/code/Blinky_Umpteen/

4) The fun part... do your local development on the desktop

5) Add your files to the local repo and commit them. Note that you don't want to add each individual Mbed OS file, but just "mbed-os.lib". This has the hashtag for the version you are using.

hg add mbed-os.lib   // do not add the individual os files
hg add main_blinky.cpp
hg commit
hg export tip
hg log

6) Now publish to the Mbed repo:

mbed publish -v

7) Wait a few minutes and inspect your online account for the changes

Let us know if you encounter any problems publishing from the CLI.

Regards,

Ralph, Team Mbed


To post an answer, please log in.