Source Control (7), GitLab Access (Setup Connection And Clone To Local)

This is a series of articles related to Source Control or Version Control issues, from stand-alone apps, such as MS SourceSafe, to Server app, such as MS TFS (Team Foundation Server), to web services, such as GitHub, AWS, and MS Azure DevOps. We tried to categorize this series of articles as Source Control or Version Control. Still, this site does not have these categories, so we make the articles in Category as DevOps, as explained in the wiki.

DevOps is a set of practices that combines software development (Dev) and IT operations (Ops). It aims to shorten the systems development life cycle and provide continuous delivery with high software quality. DevOps is complementary to Agile software development; several DevOps aspects came from the Agile methodology.

The structure of this article series will cover,

  • Stand Alone App:
    • MS Source Safe
  • Server App
    • MS TFS (Team Foundation Server)
  • Online (Cloud) Centralized Service:
    • MS Azure: DevOps
      • Boards
      • Repos
      • Pipelines
      • Test Plans
      • Artifacts
    • GitHub
    • AWS GitHub Enterprise
  • Distributed App:
    • Git

Because these are huge topics, I will not go step by step. Instead, I write any section when I feel I am ready for it, but each section will be relatively independent to become a reading unit.

Introduction

Although the GitHub or DevOps, or GitLab processes are quite complex, I believe the most important thing is setting up the environment, i.e., letting the developer access the working environment. Otherwise, we can do nothing.

In this article, we only discuss access to GitLab.

The structure of the discussion will be

  • A: Register GitLab
    • Register a new account
    • Login by GitHub account
    • Login by Google account
  • B: GitLab Client Connection Setup
    • GitLab Extension for Visual Studio
  • C: Clone Repos from Server to Local
    • From GitLab Server by VS Code
    • From Visual Studio
  • Summary

A: Register GitLab

You can open an account for GitLab from GitLab and following the instruction (For the company account, you do not need to register yourself, you will automatically log in by your Windows Credential if GitLab is available for you from your company.).  

You can register:

Or Login by GitHub account:

Or Login by Google account:

After you register, you can access Personal GitLab like this:

And Company:

The personal one could be free:

B: DevOps Client Connection Setup

Now we have server access for GitLab from a server or online, how can we access them from the client side, i.e., your computer? While for Github.com and GitHub Enterprise, we have a client-side tool, GitHub desktop; for MS Azure DevOps Repos, the client-side default tool is Visual Studio (we can use VS code, too), for GitLab, we do not have such tools, Git GUI client or through Visual Studio.

For Visual Studio, when we make Clone, we can see there are default tools for Azure DevOps and GitHub, but without GitLab

However, we can get a GitLab Extension for Visual Studio from Visual Studio Marketplace:

Note
This extension is for Visual Studio 2015/2017/2019, but not VA2022. 

Install it:

Done:

This extension is installed for Visual Studio 2019:

but not for Visual Studio 2022:

Click Connect under GitLab, we have the login prompt:

Because this part is still a bit complex, we will open another article for detailed discussion at Source Control (7-1), GitLab Extension for Visual Studio.

C: Clone Repos from Server to Local

We can get the files cloned locally by either Visual Studio 2022 or VS Code, the later one is offered by GitLab itself.

From Visual Studio 2022,

Open Visual Studio 2022 => Clone a repository

In the Clone a repository window, 

You already have the Repository location from the server:

You need to choose the Path, the folder for the local repository:

Click Clone in Clone a repository window: --- Cloning;

GitLab may verify your credential. I remember I used SSO authentication, then got the page:

Authorize: --- done

 

From GiLab Server,

Click Clone,

Choose Visual Studio Code (HTTPS)

Open Visual Studio Code:

Allow an extension to open this URL

Choose a local folder to clone the staff from the server:

If you run it the first time, GitLab may verify your credential,

Click Sign in with your Browser, you will get the page,

and it will be running,

Open the cloned files in Visual Studio Code:

Summary

This article discussed access to GitLab that follows the pattern of Source Control (5), GitHub access (setup connection) and Source Control (6), DevOps access (setup connection) exactly, those are accesses to GitHub and Azure DevOps Repos, respectively, for easy for the reader to read and easy for the writer to write.

Reference


Similar Articles