Journal: uffmm.org,
ISSN 2567-6458, Sept-30, 2019 – June-21, 2020
Email: info@uffmm.org
Author: Gerd Doeben-Henisch
Email:gerd@doeben-henisch.de
CHANGE June-21, 2020
The first approach with the server https://gitea.komega.dev has been canceled already in 2019. We have another server which will be ‘filled up’ starting in July 2020. The date of first ‘appearance’ is planned– still only a ‘sign of life’ 🙂 — at the end of July 2020. Dec-18, 2020 is fixed as publication for our first completed demo. More information about this topic will be published HERE.
ATTENTION: Change of git-server (Febr-3, 2020)
We have changed our server and the naming. The next weeks we will publish the new connections. Our main address will be: epolitics4you.org!
CONTEXT
Because the overall project now has started a first simple server and a github system using ‘gitea’ with the URL ‘https://gitea.komega.dev’ I will give here a short introduction into the usage of git/ github both on ubuntu 18.0.4 as well as Windows 10. For me this is a new approach because I started years ago with the cvs version control system. Thus let us detect how this works. This post is part of the overall python co-learning section.
GIT FOR WINDOWS 10
I am using under windows 10 a git-client mimicking a unix console (but it understands also the windows console commands). You will find it here:
A good documentation you can find under these URLs:
GIT FOR LINUX-ubuntu 18.0.4
Under ubuntu you can install the git system with the command:
$sudo apt-get install git
BASIC CONFIGURATIONS
Before one starts with the git system it is recommended to enter some basic configuration data like your name, your e-mail address and the standard editor which will be activated when you have to enter some comment.
Name:
$ git config --global user.name "Gerd Doeben-Henisch"
Email:
$ git config --global user.email gerd@doeben-henisch.de
Editor (under ubuntu):
$ git config --global core.editor "gedit --wait --new-window"
Editor (under windows):
$ git config --global core.editor notepad
You can check all the registered parameters from configure so far with the following command (example ubuntu):
gerd@Doeben-Henisch:~$ git config --list
user.name=Gerd Doeben-Henisch
user.email=gerd@doeben-henisch.de
core.editor=gedit --wait --new-window
CLONING AN EXTERNAL REPOSITORY
As mentioned we have started a github system under the URL: https://gitea.komega.dev and there I have started a test repository for the user ‘gerddh‘ with the name ‘hello1‘. In the beginning there was only a file with the same name hello1 and two other python program files vw4.py and vwmanager.py. I have checked out this repository from the ubuntu user as well as from the win10 user:
gerd@Doeben-Henisch:~$ git clone https://gitea.komega.dev/gerddh/hellogit
Klone nach 'hellogit' ...
remote: Objekte aufzählen: 9, Fertig.
remote: Zähle Objekte: 100% (9/9), Fertig.
remote: Komprimiere Objekte: 100% (3/3), Fertig.
remote: Gesamt 9 (Delta 0), Wiederverwendet 0 (Delta 0)
Entpacke Objekte: 100% (9/9), Fertig.
The cloning procedure generates a new folder github with a sub-folder .git which contains besides some git-specific management files all the files from the repository in the folder hellogit:
gerd@Doeben-Henisch:~/github/.git$ ls -al
insgesamt 40
drwxrwxr-x 7 gerd gerd 4096 Sep 25 23:03 .
drwxrwxr-x 3 gerd gerd 4096 Sep 25 22:23 ..
-rw-rw-r-- 1 gerd gerd 92 Sep 25 22:23 config
-rw-rw-r-- 1 gerd gerd 73 Sep 25 22:23 description
-rw-rw-r-- 1 gerd gerd 23 Sep 25 22:23 HEAD
drwxr-xr-x 3 gerd gerd 4096 Sep 28 15:25 hellogit
drwxrwxr-x 2 gerd gerd 4096 Sep 25 22:23 hooks
drwxrwxr-x 2 gerd gerd 4096 Sep 25 22:23 info
drwxrwxr-x 4 gerd gerd 4096 Sep 25 22:23 objects
drwxrwxr-x 4 gerd gerd 4096 Sep 25 22:23 refs
The hellogit folder looks as follows:
gerd@Doeben-Henisch:~/github/.git/hellogit$ ls -al
insgesamt 52
drwxr-xr-x 3 gerd gerd 4096 Sep 28 15:25 .
drwxrwxr-x 7 gerd gerd 4096 Sep 25 23:03 ..
drwxr-xr-x 8 gerd gerd 4096 Sep 28 15:27 .git
-rw-r--r-- 1 gerd gerd 4 Sep 25 23:03 hello1
-rw-r--r-- 1 gerd gerd 12784 Aug 19 15:49 vw4.py
-rw-r--r-- 1 gerd gerd 17498 Aug 19 12:49 vwmanager.py
WORKING WITH THE REPOSITORY
Because the git system copies the complete remote (mostly external) repository into the calling system by cloning every team member can work directly on his copy. If he changes something and he wants to share it with the remote repository he has to push the new material onto the server or fetch new material from the server. To know which addresses are used for to fetch (get) or to push the data one can enter the following command:
gerd@Doeben-Henisch:~/github/.git/hellogit$ git remote -v
origin https://gitea.komega.dev/gerddh/hellogit (fetch)
origin https://gitea.komega.dev/gerddh/hellogit (push)
In the test-scenario the win10 user did edit some new file hello2.txt added it, commited it and then pushed it on the server:
gerd_2@laptopGDH MINGW64 ~/code/hellogit (master)
$ git add hello2.txt
gerd_2@laptopGDH MINGW64 ~/code/hellogit (master)
$ git commit -m 'some content to hello2'
[master 72b9d17] some content to hello2
1 file changed, 3 insertions(+)
create mode 100644 hello2.txt
gerd_2@laptopGDH MINGW64 ~/code/hellogit (master)
$ 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 tree clean
gerd_2@laptopGDH MINGW64 ~/code/hellogit (master)
$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 385 bytes | 192.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://gitea.komega.dev/gerddh/hellogit
7dcdc68..72b9d17 master -> master
Indeed, at the server site the new file appeared. Now before the ubuntu user pushes somethign new onto the server he enters a pull command to merge his actual clone with the external repository and possible changes:
gerd@Doeben-Henisch:~/github/.git/hellogit$ git pull
Merge made by the 'recursive' strategy.
hello2.txt | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 hello2.txt
gerd@Doeben-Henisch:~/github/.git/hellogit$ ls -al
insgesamt 56
drwxr-xr-x 3 gerd gerd 4096 Sep 30 20:03 .
drwxrwxr-x 7 gerd gerd 4096 Sep 30 19:10 ..
drwxr-xr-x 8 gerd gerd 4096 Sep 30 20:04 .git
-rw-r--r-- 1 gerd gerd 71 Sep 30 19:18 hello1
-rw-r--r-- 1 gerd gerd 103 Sep 30 20:03 hello2.txt
-rw-r--r-- 1 gerd gerd 12784 Aug 19 15:49 vw4.py
-rw-r--r-- 1 gerd gerd 17498 Aug 19 12:49 vwmanager.py
As one can see does the new file from the win10 user appear in his folder. Now can the ubuntu user edit some file, here the file hello1. And then he pushes this changed file into the repository:
gerd@Doeben-Henisch:~/github/.git/hellogit$ git add hello1
gerd@Doeben-Henisch:~/github/.git/hellogit$ git commit
[master f80e580] 'The text of hello1 one has been change by ubuntu user'
1 file changed, 1 insertion(+), 1 deletion(-)
gerd@Doeben-Henisch:~/github/.git/hellogit$ git push
Zähle Objekte: 8, Fertig.
Delta compression using up to 8 threads.
Komprimiere Objekte: 100% (8/8), Fertig.
Schreibe Objekte: 100% (8/8), 1.09 KiB | 1.09 MiB/s, Fertig.
Total 8 (delta 1), reused 0 (delta 0)
To https://gitea.komega.dev/gerddh/hellogit
c3ecd20..f80e580 master -> master
FADING OUT
Ok, so far with first steps with the git system. It works nearly identical on both systems ubuntu as well as win10. Clearly there are many, many more options to use. I will use this system from now on to built up step wise our first demonstrator for our initiative called smart citizens for smart democracies (sc4sd), an application of the AAI theory described in this blog.