Gitlab Usage Summary

Source: Internet
Author: User
Tags commit visibility ssh git client sublime text git clone

Code management has been using Svn,git's branch management as the best, try it.


I. Gitlab INTRODUCTION

GitLab is an open source project for the warehouse management system. Use Git as a code management tool and build on this Web service.

Access to public or private projects via the Web interface. It features a similar feature to GitHub, with the ability to browse source code, manage defects, and annotate. You can manage the team's access to the warehouse, which makes it easy to browse through the submitted version and provide a file history library. Team members can communicate using the built-in simple chat program (Wall). It also provides a code snippet collection feature that makes it easy to code reuse.

Download and install Https://bitnami.com/stack/gitlab/installer

two. Configuration and use of GitLab 1. Create a new project (web)

1-1. After the login Gitlab URL is successful, click "+" on the right navigation bar to enter the page to create the project.

1-2. On the page where you created the project, fill in the name and visibility of the project as required.

Project path: The path to the item, which can generally be considered as the name of the project

Import Prject from: Where to import the project, provide several options such as Github/bitbucket

Description (description of the project): optional, simple description of the project

Visibility level (Project visibility levels): Provides private (privately owned, only you or members within the group can access)/internal (all logged-in users)/public (public, accessible to everyone) three options.

2. Add and configure the SSH public key:

2-1.ssh (Secure Shell) is a security protocol that, when your computer communicates with a Gitlab server, we use SSH keys (SSH keys) authentication to ensure communication security.

2-2. Create the SSH key and add the public key in the key to Gitlab so that we can access the Git repository via the SSH protocol.

SSH key creation needs to be done in the terminal (command line) environment, we first enter the command line environment. Usually in OS X and Linux platforms we use the terminal tools (Terminal), in the Windows platform, you can use the Git bash tool, git client installation directory under the Git-bash.exe file

A: Go to SSH directory: cd ~/.ssh

(1) If you do not have the ~/.ssh directory, you can manually create a (mkdir ~/.ssh), then the CD ~/.ssh into the SSH directory

(2) The Ls-l command can be used to view the files in the SSH directory to confirm that you have generated SSH key, if the SSH directory is empty, we start the second step B, generate SSH key, if there is id_ Rsa.pub This file, that you have generated SSH key before, how to add more than Sshkey is not difficult, generally rarely used, not described here.

B: Generate SSH key

We generate the key through the following command, please your_email@youremail the command. COM replaces the email address you used to register Gitlab.

Ssh-keygen-t rsa-c "YOUR_EMAIL@YOUREMAIL.COM"

The following information appears during the SSH build process, as prompted by the screen:


Note:enter passphrase (empty for no passphrase): When you can press the ENTER key two times to enter an empty passphrase, you can also choose to enter a passphrase password, If you enter a passphrase at this point, keep in mind that you will need to enter this password to confirm each commit.

In practice Android Studio if there are passwords that cannot be synced, it is recommended not to password.

Public key Default address: C:\Users\ user \.ssh

Connect the GIT server to generate a trusted file known_hosts, otherwise it will be reported: Push failed:failed with error:fatal:Could not read from remote repository.

Per Android Studio Help under SSH executable:built-in:select this option to use the implementation provided by IntelliJ Idea. Native:select this option to use Native implementation. Modify SSH executable to Native 3. Get SSH Public key information:

After the SSH key generation is completed, according to the prompt information to find the SSH directory, you will see the private key Id_rsa and public key id_rsa.pub these two files, do not disclose the private key file Id_rsa information to anyone. We can view the Id_rsa.pub public key information through a cat command or a text editor.

(1) through the editor. Use your familiar text editor, such as Notepad, Sublime text, and other software to open the id_rsa.pub, and copy all of the contents for next use.

(2) through the Cat command. Typing cat id_rsa.pub on the command line will display the contents of the Id_rsa.pub file in the command line interface after the carriage return and use it in the next step after copying.

(3) Copy the contents of the Id_rsa.pub file to the Clipboard by direct use of the command

Windows:clip < ~/.ssh/id_rsa.pub

Mac:pbcopy < ~/.ssh/id_rsa.pub

Gnu/linux (Requires Xclip): Xclip-sel clip < ~/.ssh/id_rsa.pub 4. Add SSH public key to Gitlab:

4-1. Open the Profile Configuration page of Gitlab and select SSH Keys, as shown in figure:



4-2. Add the SSH public key. Fill in the title and key, where title is the description of key, key is the above copy of the SSH public key content, paste directly into the input box to save.





5. Import the project: 5-1. Set the git username and mailbox before committing the code, you also need to set up git username and mailbox (preferably in English, do not appear in Chinese), so that the commit record will display the record with your name on Gitlab. Input in command Line window (Windows needs to install Open Git Bash tool only): Git config--global user.name "your_name"
git config--global user.email "Your_email"

5-2. Guide the new project to the Gitlab

If the project exists and needs to be imported into Gitlab, you can import the project directly from the command line.

CD "Local Presence Project path"
git init
git remote add origin git@gitlab.com:username/projectname.git
git Add.
Git commit-m ' first git demo '
git push-u Origin Master

(Note: Replace username and projectname with user name and project name)


5-3. Import the project to a local

git clone "your project Address"



Note: How to find your project address location on Gitlab, take a look at the following image:





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.