If your CLI is configured properly, you should be able to pull the code from the repository straight to your local development environment:
Navigate to the repository from which you would like to pull your code.
Click on Code and click SSH.
Copy the SSH line that is noted there. Ensure that your command line is currently open in the folder that you want the repository to be cloned into. Run the following command on it:
$ git clone {SSHLine}
Your repository should now be in the form of a folder; you just need to change the directory into that new folder.
Creating a GitHub repository for your code
Your GitHub repository is where you will be storing, committing, and pushing your code. You will need to create one via GitHub to then push and pull to and from your local development environment:
On your GitHub home page, click on New repository.
Type a name for your repository and add a description of it.
Choose the visibility of your repository. Unless you want to prevent your repository from being accessed publicly, select Private.
Select Initialize this repository with a README to continually update your repository with a summary.
Select Create Repository.
You should now be able to push to the repository as part of the next section.
Initializing, committing, staging, and pushing – oh my!
These four steps are a crucial part of any GitHub experience, as you want to store the code and continually update the repository based on the changes you have done to collaborate with others or simply just to track the changes that you have made as part of the version control process.
To understand how these four steps work for your projects, let’s go through them:
To initialize a folder as a Git development folder, type in the following and a .git folder should be initialized in your folder:
Note that if the folder is already initialized as a local repository and the remote URL is already set, we will only have to repeat steps 2, 3, and 6 for every consecutive push.
Testing it for your newly created Hello World LED project
Now that we have the skills for GitHub, let’s use it to push your newly created Hello World LED project’s code into GitHub:
Create a repository on GitHub as per the instructions just given for creating a new repository.
On your command prompt, navigate to the folder containing your project code. Run git init to initialize the folder as a repository:
Enter a commit message that makes sense for adding this deployment. In this case, it might be something as simple as this:
Navigate to your repository page on GitHub and copy the HTTPS URL on the project. Paste it within the command to add the origin for the project:
Push the changes you already have staged to the repository:
And with that, you have your first repository good to go! Try to practice making a few changes to your code and repeating the process. See whether you can answer the following questions:
How can I revert to a previous version of my code?
What types of branches would I need to create for an industry-based IoT project?
With this, you should now be able to use the Arduino IDE, try out a practical exercise that demonstrates the capabilities of Arduino at a high level, and create and use GitHub in your local environment for version control. In the next section, we will explore how we can choose between IoT hardware, considering the unique set of requirements that projects need.