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 Install Https://bitnami.com/stack/gitlab/installer (This is a one-click installation package, installation is simple, omitted here)
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.
650) this.width=650; "title=" 1.png "alt=" 1.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 39a7d045e62c67e6e40ace502b88ef89.png "/>
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.
650) this.width=650; "title=" 2.png "alt=" 2.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ F1bdb85efab13d845ece99536f9b28a1.png "/>
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
650) this.width=650; "title=" 3.png "alt=" 3.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ B40c6fda2f2479d1e55fa1f0f75cfadb.png "/>
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 replace [email protected] in the command with the email address you used to register Gitlab.
Ssh-keygen-t rsa-c "[Email protected]"
The following information appears during the SSH build process, as prompted by the screen:
650) this.width=650; "title=" 4.png "alt=" 4.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 9be6239fe4e93e2ff19d08dec8a9cf66.png "/>
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.
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 the SSH public key to Gitlab:
4-1. Open the Profile Configuration page of Gitlab, select SSH Keys,
650) this.width=650; "title=" 5.png "alt=" 5.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 3022e369934971c5e6fc784c24e73408.png "/>
650) this.width=650; "title=" 6.png "alt=" 6.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 03683e1b5694aa4a38ca402fe26f4e6c.png "/>
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.
650) this.width=650; "title=" 7.png "alt=" 7.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 4d4bb070758a9130bbb87e51502bab27.png "/>
650) this.width=650; "title=" 8.png "alt=" 8.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ B97aa5ad6fabe879e1df53d520b92df0.png "/>
5. Windows Client Operations
Now open the web to find the project you just created, there will be related action configuration tips
Note: The gitlab.example.com in the warehouse address needs to be replaced with your server IP address in the following client configuration. (because I installed the package with one click, not configured in detail)
650) this.width=650; "title=" 9.png "alt=" 9.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 51bed289ee20878c4893c6e49bc0edae.png "/>
Example:
Client opens Git bash
Command line Instructions
Git Global Setup (Global Settings)
git config--global user.name "* * *"
git config--global user.email "* * * * @qq. com"
Create a new repository (creating a newer repository) clone
git clone [email protected]:ceshi/bbbbb.git
CD BBBBB
Touch readme.md
git add readme.md
Git commit-m "Add README"
Git push-u Origin Master
Existing folder or Git repository (existing folders or git repositories)
#在本地的文件夹空白处, right-click Git bashgit init
git remote add origin [email protected]:ceshi/bbbbb.git
git Add.
Git commit
Git push-u Origin Master
This can be done happily, git add, git commit, git push
6. Import the project:
6-1. Set the username and mailbox under git
Before committing the code, you also need to set up the username and mailbox under git (preferably in English, not in Chinese) so that the commit record will display a record with your name on the Gitlab.
Enter in the Command Line window (Windows needs to be installed to open the Git Bash tool only):
git config--global user.name "your_name"
git config--global user.email "Your_email"
6-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.
[Plain] View plain copy
CD "Path of Local Presence project"
Git init
git remote add origin [email protected]: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)
6-3. Import the project to a local
git clone "your project Address"
650) this.width=650; "title=" 10.png "alt=" 10.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ B98e84cd317ecba25ef8a2c9bb7b6d7c.png "/>
Note: How to find the location of your project address on Gitlab, please see:
650) this.width=650; "title=" 11.png "alt=" 11.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 81f516e6225acdcedcd2633a5742de36.png "/>
650) this.width=650; "title=" 12.png "alt=" 12.png "src=" http://ask.apelearn.com/uploads/questions/20161025/ 75d5a0389e914269522482ddca9f067b.png "/>
Gitlab Installation Configuration Usage Summary