Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 9 months 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:
3 Answers
6 years, 9 months 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:
- Go to your account profile page (from the top right corner of the page, click your username and then select Profile).
- Select the Code tab.
- 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
5 years, 11 months 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?
5 years, 11 months 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
Hi Ralph,
thank you very much for your comment. However...
1. Mbed-hosted repository created
2. Mbed program created and Mercurial repository initilized (it creates ".hg" folder)
3. hgrc file created (there was no any hgrc file in .hg folder before, so I needed to create it manually) and I changed the content of hgrc file to:
[paths] default = https://marcinch:<password>@os.mbed.com/users/marcinch/code/CLI_publishing_from_local/
And command as follows confirms that hgrc file is created in proper way:
hg paths
It displays:
default = https://marcinch:***@os.mbed.com/users/marcinch/code/CLI_publishing_from_local/
4. Fun part needs to wait a bit :)
5. I added files you mentioned in your guide (mbed-os.lib, main.cpp), then commited, exported.
hg log
displays:
changeset: 0:109e19f88f1f tag: tip user: marcin date: Tue Dec 11 11:55:41 2018 +0100 summary: asasas
6. And now publish gives an error
ERROR: Program "blinky" in "C:\mbed_projects\blinky" is a local repository. Please associate it with a remote repository URL before attempting to publish.
Bit strange as hgrc file exists and seems to be working properly. Any hints for that? Did I miss something? Did I forget about something?
posted by 11 Dec 2018