Labs

Version Control System Labs

Github Working Repository Creation

Once signed up in Github create a working repository

  • Select "+" in the upper right corner then "New Repository"

    • Name TheIoTLearningInitiative

    • Description TheIoTLearningInitiative

    • Select "Initialize this repository with a README"

    • Add a License type "Apache License 2.0"

    • Then "Create Repository"

Finally your github repository should be created having a url

https://github.com/YourGithubUserName/TheIoTLearningInitiative

Git Installation and Setup under Development Board

Make sure you have git installed in your Linux box

root@edison:~# opkg update                                                      
Downloading http://repo.opkg.net/edison/repo/all/Packages.gz.                   
Inflating http://repo.opkg.net/edison/repo/all/Packages.gz.                     
Updated list of available packages in /var/lib/opkg/all.                        
Downloading http://repo.opkg.net/edison/repo/edison/Packages.gz.                
Inflating http://repo.opkg.net/edison/repo/edison/Packages.gz.                  
Updated list of available packages in /var/lib/opkg/edison.                     
Downloading http://repo.opkg.net/edison/repo/core2-32/Packages.gz.              
Inflating http://repo.opkg.net/edison/repo/core2-32/Packages.gz.                
Updated list of available packages in /var/lib/opkg/core2-32.                   
Downloading http://iotdk.intel.com/repos/3.5/intelgalactic/opkg/i586//Packages. 
Downloading http://iotdk.intel.com/repos/3.5/iotdk/edison/all/Packages.         
Downloading http://iotdk.intel.com/repos/3.5/iotdk/edison/core2-32/Packages.    
Downloading http://iotdk.intel.com/repos/3.5/iotdk/edison/edison/Packages.      
Collected errors:                                                               
 * opkg_download: Failed to download http://iotdk.intel.com/repos/3.5/intelgala.
 * opkg_download: Failed to download http://iotdk.intel.com/repos/3.5/iotdk/edi.
 * opkg_download: Failed to download http://iotdk.intel.com/repos/3.5/iotdk/edi.
 * opkg_download: Failed to download http://iotdk.intel.com/repos/3.5/iotdk/edi.
root@edison:~#
root@edison:~# opkg install git                                                 
Package git (2.0.1-r0) installed in root is up to date.                         
root@edison:~#

Configure your name and email under Git:

root@board:~# git config --global user.name "YourName YourLastName"
root@board:~# git config --global user.email "your.email.address@wherever.com"

Github Repository Cloning

Clone your remote github repository under your development board

root@board:~# git clone https://github.com/YourGithubUserName/TheIoTLearningInitiative.git
Cloning into 'TheIoTLearningInitiative'...                                      
remote: Counting objects: 63, done.                                             
remote: Compressing objects: 100% (16/16), done.                                
remote: Total 63 (delta 9), reused 0 (delta 0), pack-reused 43                  
Unpacking objects: 100% (63/63), done.                                          
Checking connectivity... done. 
root@board:~#

Github Repository Local Modifications

This procedure applies every time you modify a file.

root@board:~# cd TheIoTLearningInitiative/
root@board:~/TheIoTLearningInitiative# ls 
LICENSE    README.md
root@board:~/TheIoTLearningInitiative# cat README.md 
# TheIoTLearningInitiative
The IoT Learning Initiative
root@board:~/TheIoTLearningInitiative# nano README.md
# The IoT Learning Initiative
Hello Git!
<Save Changes>
root@board:~/TheIoTLearningInitiative# git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   README.md
no changes added to commit (use "git add" and/or "git commit -a")

Github Repository Commit Modifications

root@board:~/TheIoTLearningInitiative# git add README.md
root@board:~/TheIoTLearningInitiative# git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   README.md
root@board:~/TheIoTLearningInitiative#

Before we commit our changes, some sharing of wisdom

  • First line: Title starting with your githubusername, 50 chars max

  • Second line: A blank line

  • Third line: Description of the changes, as many lines as required, 80 chars max per line

Now, let's commit our changes

root@board:~/TheIoTLearningInitiative# git commit -s
First Line: Summary of the commit

Beggining of the third line you write the description of the commit

Signed-off-by: Name LastName <email@someplace.com>
<Save Changes>
[master 6d30317] First Line: Summary of the commit
1 file changed, 2 insertions(+), 2 deletions(-)
root@board:~/TheIoTLearningInitiative#
root@board:~/TheIoTLearningInitiative# git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working directory clean
root@board:~/TheIoTLearningInitiative# cat README.md 
# The IoT Learning Initiative
Hello Git!
root@edison:~/TheIoTLearningInitiative#

Github Repository Push Modifications

root@board:~/TheIoTLearningInitiative# git push
Username for 'https://github.com': username
Password for 'https://username@github.com': 
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 392 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/xe1gyq/TheIoTLearningInitiative.git
   3796444..6d30317  master -> master
root@board:~/TheIoTLearningInitiative# ls
LICENSE    README.md

See changes under https://github.com/YourGithubUserName/TheIoTLearningInitiative

Project: Base Directory

Make a directory called "InternetOfThings101", create a README.md file and push modifications

root@board:~/TheIoTLearningInitiative# mkdir InternetOfThings101
root@board:~/TheIoTLearningInitiative# cd InternetOfThings101/
root@board:~/TheIoTLearningInitiative/InternetOfThings101# ls
root@board:~/TheIoTLearningInitiative/InternetOfThings101#
root@board:~/TheIoTLearningInitiative/InternetOfThings101# nano README.md
# Internet of Things 101
<Save File>
root@board:~/TheIoTLearningInitiative/InternetOfThings101# ls
README.md
root@board:~/TheIoTLearningInitiative/InternetOfThings101# git add README.md
root@edison:~/TheIoTLearningInitiative/InternetOfThings101# git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   README.md
root@board:~/TheIoTLearningInitiative/InternetOfThings101# git commit -s
Internet of Things 101: 5.1.4.5 VCS: Project: Base Directory

Make a directory called "InternetOfThings101", create a README.md file
and push modifications

Signed-off-by: Name LastName <email@someplace.com>
<Save File>
[master 7b6f34c] Internet of Things 101: 5.1.4.5 VCS: Project: Base Directory
1 file changed, 1 insertion(+)
create mode 100644 InternetOfThings101/README.md
root@board:~/TheIoTLearningInitiative/InternetOfThings101# ls
README.md
root@board:~/TheIoTLearningInitiative/InternetOfThings101# git push
Username for 'https://github.com': 
Password for 'https://username@github.com': 
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 445 bytes | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/xe1gyq/TheIoTLearningInitiative.git
   6d30317..09c72e1  master -> master
root@board:~/TheIoTLearningInitiative/InternetOfThings101# git show
commit 7b6f34c74473d50cd7078a2741b37706c2015500
Author: Name LastName <email@gmail.com>
Date:   Sat Apr 30 22:04:46 2016 +0000

    Internet of Things 101: 5.1.4.5 VCS: Project: Base Directory

    Make a directory called "InternetOfThings101", create a README.md file
    and push modifications

    Signed-off-by: Name LastName <email@gmail.com>

diff --git a/InternetOfThings101/README.md b/InternetOfThings101/README.md
new file mode 100644
index 0000000..c8bd91a
--- /dev/null
+++ b/InternetOfThings101/README.md
@@ -0,0 +1 @@
+# Internet of Things 101

See changes under https://github.com/YourGithubUserName/TheIoTLearningInitiative

Your github repository directory structure shall be at this point as follows:

TheIoTLearningInitiative Github Repository
https://github.com/YourGithubUserName/TheIoTLearningInitiative
├── LICENSE
├── README.md
├── InternetOfThings101
   ├── README.md

Last updated