Use of Git

Source: Internet
Author: User

Use of Git

After registering your github account on the http://github.com, You need to execute the statement

Git config -- global user. name "yourname"

Git config-global user. email "XXX@XXX.com"

In this way, your account is marked locally and can be directly used later.

To upload files to GitHub's Git system, you need an SSH key for authentication. You can do this in two steps:

(1) Create an SSH key:

Ssh-keygen-C "your@email.address"-t rsa

You can choose to enter the storage location of the SSH key. You can directly press enter to use the default path.

(2) Submit the SSH Key to GitHub.

A. First open the location where the Key is saved. There will be three files in it, find id_rsa.pub, open it in a text editor, and copy all the characters in it.

B. log on to GitHub, find Account Settings in the toolbar at the top right, find the SSH Public Keys tag, and select Add another public key. Edit the Title by yourself. paste the Key and submit it.

To upload code to git:

(1) git init

Create a repository.

(2) git add XXX

Add file XXX. Add "." To add all files in the current directory.

(3) git commit-m'message'

The description message is added during the upload.

(5) git remote add origin XXX@github.com: XXX/XXX. git

This statement uses origin as an alias for XXX@github.com: XXX/XXX. git, and later you can easily use origin to represent the XXX@github.com: XXX/XXX. git.

Git remote rm origin is used to delete aliases.

(6) git push-u origin master

Upload the current directory to the master branch of github

Common git commands are as follows:

1. git clone

Eg: git clone git: // github.com/XXX/XXX.git some_project

Clone the remote repository of 'git: // github.com/xxx/xxx.git' to the xxxdirectory.

2. git init

Initialize the current directory. After initialization, a directory named. git will appear under the current directory. All the data and resources required by Git are stored in this directory.

3. git status

View the status of the corresponding files in the current directory in git

4. git commit

Submit changes to the current Workspace

Eg: git commit-m "update code" '. You must use-m to enter a piece of commit information during submission.

5. git add

Add the modified or newly added files to the git index.

Eg: git add test. c will add the test. c file to the git index.

Git add. -- add all current changes to the git Index

6. git pull

Update the code from other version libraries (either remote or local) to the local

Eg: 'git pull origin master is to update the code of the origin version Library to the local master branch.

7. git rm

Delete files from current workspace and Index

Eg: git rm test. c

8. git push

Update the code of the local commit to the remote version library.

Eg: git push origin updates the local code to the remote version library named orgin.

Gitolite-based Git service setup

Fedora downloads Git through Http Proxy

Install Git on Ubuntu Server

Create a Git repository on the server (Ubuntu)

Git simple tutorial in Linux (taking Android as an example)

Git authoritative guide PDF

Git details: click here
Git: click here

This article permanently updates the link address:

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.