Install and use Git in Ubuntu

Source: Internet
Author: User
Tags using git
Git is a fast and Scalable Distributed version control system. It has a rich set of commands and provides advanced operations and full access to internal systems. 1. Install Git: 1. install it in binary mode: $ sudoapt-getinstallgit-core. After the installation is complete, enter git in the terminal to view the related commands. If you only need to use git to manage local code, you can use it now. If you need to work with a github project, you also need

Git is a fast and Scalable Distributed version control system. It has a rich set of commands and provides advanced operations and full access to internal systems.

1. Install Git:

1. Binary installation:

$ Sudo apt-get install git-core

After the installation is complete, enter git in the terminal to view the relevant commands. If you only need to use git to manage local code, you can use it now. If you need to work with a github project, you need to do other operations.

2. github account application
If you only need to copy the code you are interested in on github to your local computer and use it for modification without sharing the release, it does not matter if you do not apply for an account, you only need to clone the code locally by using git. $ Git clone git: // IP work (working directory name ).
After all, github is used for Open Source purposes. First, register an account on github.com.

3. Create a local folder and initialize some global variables.
$ Git config -- global user. name = "user name or user ID"
$ Git config -- global user. email = email
These two options will be automatically added to the Code during future use.


4. Create a public key for verification
This is a complicated and confusing issue for most people. Because git accesses the resource library through ssh, it is necessary to create a file for authentication locally. Use the command: $ ssh-keygen-C 'you email address@gmail.com '-t rsa will be in the user directory ~ /. Ssh/to create the corresponding key file. You can use the $ ssh-v git@github.com command to test whether the link is unblocked.


5. Upload the Public Key
On the github.com page, select Account Settings in the upper-right corner, select SSH Public Keys, and select Add.
Title can be named at will. The Key content is copied from ~ /. Ssh/id_rsa.pub content, after completion, you can use the ssh-v git@github.com for testing. The following information indicates that the verification is successful.

Ii. Configure and use Git

You can use github to manage your projects by following the steps below.

1. Create a warehouse

Use git init to create a repository in the folder where you want to create a project. After that, you can see an additional. git hidden directory in the file home.

2. Add a file

Use git add. To add an initial file. In this example, all the files in the folder are added. You can also specify the file to be added.

3. Submit a file

Use git commit-m'comment' to submit the edited content.

4. delete or add remote github sources

Git remote add origin https://github.com/Git-Elite/CodeBase.git // The repository address hosted by github in the Blue Section

5. submit it to the github repository.

Git push-u origin master

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Related Article

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.