[Fun With Ubuntu] 04. Configure the GIT environment on Ubuntu

Source: Internet
Author: User
Tags git commands


1. Use PPA to install git

PPA, indicating the personal package archives, that is, the personal package set.

There are a lot of software, for various reasons, cannot enter the official Ubuntu software repository. To facilitate usage by Ubuntu users, launchpad.net provides PPA, allowing users to build their own software repositories and upload software freely. PPA is also used to test software that is going to enter the official Ubuntu repository, or new versions of some software.

The software on PPA is extremely rich. If the official Ubuntu repository lacks the software you need, you can go to PPA to find it.


# Not much to say, start to install bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ $ Sudo apt-add-repository PPA: Git-core/ppabixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ $ Sudo apt-Get updatebixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ $ Sudo apt-Get install git # view git version bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ $ Git -- versiongit version 1.8.3.4

# According to your system language, git will have a corresponding version, my Ubuntu is Chinese, so there will be a Chinese version of bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ $ Git help usage: git [-- version] [-- help] [-C name = value] [-- Exec-path [= <path>] [-- HTML-path] [-- Man-path] [-- info-path] [-p | -- paginate | -- no-Pager] [-- no-replace-objects] [-- bare] [-- git-Dir = <path>] [-- work-tree = <path>] [-- namespace = <Name>] <command> [<ARGs>] The most common git commands are: add file content to index bisect locate introduced bug changes branch list, create or delete branch checkout check out a branch or path to work zone clone a version library to a new directory commit record changes to version library diff display differences between commits, between commits, and between work zones F Etch downloads objects from another version library and references the grep output and pattern matching line init to create an empty git version library or reinitialize an existing version library log display commit log merge two or more development history music videos move or rename a file, directory, or symbolic link pull to obtain and merge another version library or a local branch push update remote reference and Related Object rebase local commit migrate to the updated upstream branch reset to reset the current head to the specified state RM delete files from the workspace and index show various types of object Status display workspace status tag create, List, delete or verify the tag object commands 'git help-a' and 'git help-G' of a GPG signature to display available sub-commands and guidelines. See 'git help <command> 'or 'git help <guide>' to view the help or guide for a given sub-command.

2. Install SSH on Ubuntu

By default, the SSH service is not installed in Ubuntu. If you connect to Ubuntu through SSH, You need to manually Install SSH-server. To determine whether to install the SSH service, run the following command:

Bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ $ SSH localhostssh: connect to host localhost port 22: Connection refused # The above result is not installed hello, the following install bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M: ~ $ Sudo apt-Get install OpenSSH-Server
3. Create a public key for verification

#1. create an SSH keyssh-keygen-t rsa-c "Xiaopeng in your mailbox. BXP @*******. com "# generating public/private RSA key pair... cat ~ /. Ssh/id_rsa.pub # ssh-RSA aaaab3nzac1yc2eaaaadaqabaa450c6entgpngwstc ....

#2. Add an SSH key
Open GitHub or gitlab, create an SSH key in SSH keys, and copy ~ Put the content in/. Ssh/id_rsa.pub into the SSH key and save it.

# Try to clone the code from gitlab bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ /Workspace2 $ git clone http: ********* is cloning to 'spark '... username for 'http: // gitlab. ****. com ': Xiaopeng. bxppassword for 'http: // Xiaopeng. BXP @ gitlab. ***. com ': Fatal: authentication failed for 'http: // gitlab.alibaba-inc.com/sospartan/spark.git/'sorry, I entered the user name and password, indicating that our SSH key is not paired, or we are not correct. Try to modify # Run the clone command bixiaopeng @ bixiaopeng-to-be-filled-by-O-E-M :~ /Workspace2 $ git clone http: // gitlab. ***. COM/sospartan/spark. git is cloning to 'spark '... remote: counting objects: 7778, done. remote: compressing objects: 100% (5044/5044), done. remote: Total 7778 (delta 4649), reused 3891 (delta 2186) received objects: 100% (7778/7778), 7.46 MIB | 9.75 MIB/s, done. processing delta: 100% (4649/4649), done. checking connectivity... done

Successful !!

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.