Instruction to use rtgit

I. Purpose

  • A system that records changes to files over time, so that you can recall specific versions later.
  • Replace SVN & partly rtBox.
  • Better in versioning with feature of merge, revert, diff,…

II. Registration

  1. Go to site https://rtgit.rta.vn

  2. Select tab Register and fill in your information:

1

  1. Click button Register then the main screen will show up like this:

(Just only do this step if you haven’t registered before on https://rtgit.rta.vn)

III. Installation

Click here for more detail

A. For Windows

  1. Go to site https://git-scm.com

  2. Download Git for Windows.
    2

B. For Ubuntu Linux

  1. Open Terminal
  2. Enter in the following commands:

sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

C. For macOS

  1. Install Xcode
  2. Install Homebrew
  3. Install Git via Homebrew:
    i. Open Terminal
    ii. Enter in the following commands:

brew install git

IV. SSH Keys creation

A. For Windows 10

1. Install the Windows Subsystem for Linux:
i. Open PowerShell as Administrator:


ii. Run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

iii. Wait for the result as following:


2. Restart computer.
3. Open GitBash
6
4. Type the following:

ssh-keygen -t rsa -C “your.email@address”

8

5. Get content of SSH Keys to paste into rtgit:

i. Open the file (for example, in step 3 above filename is id2_rsa.pub) using Notepad or Notepad++:

ii. Copy the whole content showed in the file (from ssh-rsa to youremail):

11

6. Sign in to rtgit.rta.vn then paste content of SSH Keys into rtgit:

12

B. For Windows 7 - 8

1. Open GitBash:

6

2. Type the following:

ssh-keygen -t rsa -C “your.email@address”

8

3. Get content of SSH Keys to paste into rtgit:

i. Open the file (for example, in step 3 above filename is id2_rsa.pub) using Notepad or Notepad++:

ii. Copy the whole content showed in the file (from ssh-rsa to youremail):

11

4. Paste content of SSH Keys into rtgit:

12

V. Usage

Unlike rtBox, Google Drive, which folder system use similar terms that we, non-IT guys, can understand, Git use “strange” words to describe their system. You should know about them before using the functions it Git system.

a. Repository:

  • It can easily explained as a parent folder.
  • The “folder” in server is called Remote Repository. It is also the same as the project you create online in rtgit.
    (For your easier understanding, it is like the Data Entry on server).
  • The “folder” in local, i.e. your computer is called Local Repository.
    (It is like the instances folder in RTAnalytics folder in app device).

b. Workspace or Working Directory:

  • The specific space or location in your computer where you are currently working at. (It is like the Edit form in rtSurvey app).

c. Staging Area:

  • The area contains stuffs ready to send to Remote Repository.
    (It is like the Send Form in rtSurvey app).

The following steps will be all conducted using GitBash
(remember how to open it in section IV SSH Keys Creation).

1. Git config

This step is to declare your identification with your computer, i.e. in your local environment. (It is like registering your rtSuvey app to server).

  • Type the following commands in GitBash (press Enter after finish each line):

git config --global user.name “Your Full Name”
git config --global user.email “your.email@mail.ext”

For example:

14

2. Git clone

This step is to copy (download) all contents of an existing project in remote repository to your working directory. Please note that this step is only conducted when the your working directory does not have any content of that project.

(It is like downloading forms from server to your rtSurvey app).

  • Right click at the folder you want the new repository to be downloaded,
  • Open GitBash,
  • Type the following command:

git clone [project/url]

For example, you want to download the project rtST Testing And Training and saved as a sub-folder in folder PINKA_RTA in your computer:
- Sign in to your rtgit account in rtgit.rta.vn and do the followings:

16

- Copy the project url:

- After you copy the project url, open Windows Explorer and do the followings:

18

- Type the following:

git clone ssh://git@rtgit.rta.vn:2224/rta_thiendao/rtst-testing-and-training.git

19

If you do the git clone correctly, new folder will show up in the location you selected, and you can work with this folder in your local environment like any other normal folders:

20

3. Git status

This step is to check status of git contents: updated or not (compared local with remote), files sent to server or not and where it is (still in working area, staging area, or in local)

  • Right click at the folder you want to check the status,
  • Open GitBash,
  • Type the following command:

git status

21

Example 1: Your local repository got updated. Nothing needed to download or upload.

22

Example 2: There is 1 file still in working area

Example 3: There is 1 file still in staging area

Example 4: There is 1 file in Local Repository but not in Remote Repository

4. Git add, git commit, git push

These are the series of steps to upload contents from local repository to remote repository.

  • Right click at the working directory you want to upload files,
  • Open GitBash,
  • If you want to upload all content of the folder into Staging Area, type the following command:

git add .

  • If you want to upload 1 specific file into Staging Area, type the following command:

git add < filename >

  • To add the files into Local Repository, type the following command:

git commit -m “commit message”

  • To upload the files into Remote Repository, type the following command:

git push

Example 1a: git add all content

27

Example 1b: git add 1 file

28

Example 2: git commit

29

Example 3: git push

30

To add and commit content of 1 folder only, please use:

git add my-folder
git commit -m “message” – my-folder

For example:

31

32

5. Git pull

This step is to update content from remote repository to local repository. It means you already have that project in your local repository.
(It is like downloading the form with newer version into rtSurvey app to overwrite the current version)

  • Right click at the working directory you want to update files,
  • Open GitBash,
  • Type the following command:

git pull

34