Wednesday, November 16, 2016

How to clone Contiki OS from Github using git

Objective

To clone the Contiki OS software from Github. Then, to upload the Contiki files to your own Github repository.

Step 1: Clone the Contiki OS software from Github

To clone Contiki OS from github, go to your desktop directory and clone Contiki as follows:

cd /home/YOUR_USER/Desktop/
git clone https://github.com/contiki-os/contiki.git

After this step, the following directory was created /home/YOUR_USER/Desktop/contiki. That's it, you are done! Now, you can develop your own applications under Contiki. If you want to upload the Contiki files to your own Github repository see the next step.

Step 2: Upload the Contiki files to your own Github repository

If you develop applications for Contiki and want to save this files in your own Github repository, read this section. First you need to create your own repository, and to do so, see the following link, specifically see the section Create a new repository on GitHub:

https://help.github.com/articles/create-a-repo/

Then, 1) Go to your contiki folder 2) Add your remote repository, 3) Verify that it was added, 4) upload the Contiki files to your repository with the push command:

cd /home/YOUR_USER/Desktop/contiki
git remote add NAME_YOU_CHOOSE https://github.com/YOUR_GITHUB_USER/YOUR_GITHUB_REPOSITORY.git
git remote -v
git push -u NAME_YOU_CHOOSE master

After the push command, you must introduce your Github user and password. Then, go to your Github repository and verify that the file were uploaded, you must see this:

Now, we are going to create a new folder named MyExample, and a file named example.c

cd /home/YOUR_USER/Desktop/contiki/examples/
mkdir MyExample
cd /home/YOUR_USER/Desktop/contiki/examples/MyExample
> example.c

Next, we are going to: 1) see the status of the git 2) Add all the changes to Github 3) Commit the changes 4) Upload the changes with the push command.

git status
git add -A
git commit -m "This is the Commit Message"
git push -u NAME_YOU_CHOOSE master

After the push command, you must introduce your Github user and password. That's it, you are done! Now, go to your Github page, and look for the folder /YOUR_GITHUB_REPOSITORY/examples/MyExample and its file example.c.

No comments:

Post a Comment