# 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

```bash
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:~#
```

```bash
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:

```bash
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

```bash
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.

```bash
root@board:~# cd TheIoTLearningInitiative/
```

```bash
root@board:~/TheIoTLearningInitiative# ls 
LICENSE    README.md
```

```bash
root@board:~/TheIoTLearningInitiative# cat README.md 
# TheIoTLearningInitiative
The IoT Learning Initiative
```

```bash
root@board:~/TheIoTLearningInitiative# nano README.md
# The IoT Learning Initiative
Hello Git!
<Save Changes>
```

```bash
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

```bash
root@board:~/TheIoTLearningInitiative# git add README.md
```

```bash
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

```bash
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#
```

```bash
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
```

```bash
root@board:~/TheIoTLearningInitiative# cat README.md 
# The IoT Learning Initiative
Hello Git!
root@edison:~/TheIoTLearningInitiative#
```

### Github Repository Push Modifications

```bash
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
```

```bash
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

```bash
root@board:~/TheIoTLearningInitiative# mkdir InternetOfThings101
```

```bash
root@board:~/TheIoTLearningInitiative# cd InternetOfThings101/
```

```bash
root@board:~/TheIoTLearningInitiative/InternetOfThings101# ls
root@board:~/TheIoTLearningInitiative/InternetOfThings101#
```

```bash
root@board:~/TheIoTLearningInitiative/InternetOfThings101# nano README.md
# Internet of Things 101
<Save File>
```

```bash
root@board:~/TheIoTLearningInitiative/InternetOfThings101# ls
README.md
```

```bash
root@board:~/TheIoTLearningInitiative/InternetOfThings101# git add README.md
```

```bash
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
```

```bash
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
```

```bash
root@board:~/TheIoTLearningInitiative/InternetOfThings101# ls
README.md
```

```bash
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
```

```bash
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:

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://theiotlearninginitiative.gitbook.io/internetofthings101/architecture/thing/embedded-linux/version-control-systems/labs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
