Setup GitLab using Git for Windows

Table of Content

Register GitLab

Firstly, register GitLab and create a project. No contents are required at this moment as this project will be cloned to Windows directory.

Install Git for Windows

Download Git for Windows from this site and install it. Default settings are recommended except Adjusting your PATH environment where Use Git from Git Bash only is recommended to choose for safety.

Initial setting for Git

Open Git Bash and set as follows. Here, Hidemaru Editor is chosen. and should be those registered in GitLab. Quotation marks are also required.

$ git config --global core.editor \'/C/Program Files (x86)/Hidemaru/Hidemaru.exe\' //fu8
$ git config --global Your Name 
$ git config --global
$ git config --global core.quotepath false

Setting for SSH and registration of public key in GitLAB

Move to the following directory in Git Bash under the installed directory of Git for Windows:

$ cd "/C/Program Files/Git/usr/bin"

Create a pear of SSH keys using the registered email address. Enter passphrase is entering password. You may put it as blank for convenience.

$ ssh-keygen -t rsa -C \'\'

Click on a red mark at the right most on the top tool bar of GitLab, click on settings , and click on SSH Keys at the left menu.
Then, Add an SSH key will appear. Copy and paste the public key in the form of Key , put any title on the form of Title, and click on Add key.
This public key should exist in the following directory, which should be opened using an editor and all its contents, including the mail address, should be copied and pasted in the form of Key in GitLab.


Clone and Fork

Clone is usually copying a remote repository to a local repository. On the other hand, Fork is originally a function of Github (it can also be used in GitLab), and it is a mechanism to copy another person's repository as his / her own repository and notify the developer of the original repository. Fork is supposed to contribute to the original repository. So if you just want to copy someone else's repository as your own repository, you should use Clone.

Clone remote repository to GitLab

You can clone an open source model remote repository directly as your GitLab project.
Log in to GitLab and click the green icon New Project at the top right of the top page.
Next, click the Import project tab and click Repo by URL as shown below.

Next, fill in the Git repository URL form as shown below. Enter when you want to clone a project like git clone MyDir in Git Bash. Some repositories may require a username and password, in which case you should fill in the Username (optional) and Password(optional) forms, respectively.
If you check Mirror repository, the repository will be updated automatically. However, be careful of conflicts.
Enter an appropriate project name in the Project name form.
Project URL and Project slug can be left as default.
Write a description of the project in Project description (optional).
GitLab has a function to create group corresponding to a sub-folder. To use this, click Create a group under the Project URL and set it appropriately.
Visibility Level may be private Private (default).
Finally, click the green icon Create project at the bottom right to build the project.

Clone a project of GitLab

Create a working directory and move to the directory on Git Bash where the project in GitLab is to be cloned. A new directory of the project name will be created when cloned.
Open the page of project on GitLab. Clicking on a blue icon of Clone at the top-right and copy an expression in SSH like: and execute as follows:

$ git clone

A new directory of project will be created in this example. Create or copy files that are to be managed by Git.

Push to GitLab

You may refer to this page. In the following, register files with the extension of F and makefile in the sub-directory of sub in the index. Check the status of index registration and commit them to the local repository (editor will be opened and put a comment). Finally, push to GitLab by git push.

$ git add *.F git add sub/makefile
# Remove a file from the version control (the file remains).
$ git rm --cached test.F
# All the modified files under the version control are added.
$ git add -u git status git commit git push

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.