Initial use of git and GitHub

Source: Internet
Author: User
Tags git client

Steps for using GitHub:

1. Apply for a GitHub account XXX and create a new repository named new-project.


2. Install the GIT client (Linux)

# Yum install git Git-Gui


3. Generate a key pair so that the project can be pushed to GitHub.

# Ssh-keygen-t rsa-c "xxx@gmail.com"

4. Copy. Ssh/id_rsa.pub to the GitHub website.

5. For convenience, set SSH without entering a password

# Eval 'ssh-agent'

# Ssh-add

(Input passphrase)


6. Test whether GitHub can be connected

# SSH git@github.com

If the configuration is correct

Error: Hi XXX! You 've successfully authenticated, but GitHub does not provide shell access

Connection to github.com closed.


7. Set git global user configuration

# Git config -- global user. Name "XXX"

# Git config -- global user. Email xxx@gmail.com


8. Create a new local project work tree

# Mkdir New-Project

# Cd New-Project

# Git init

# Touch readme

# Git add readme

# Git commit-m'first commit'

Define Remote Server alias Origin

# Git remote add origin git@github.com: xxx/new-project.git

Local and remote merge. The local default branch is master.

# Git push origin master


GitHub site can see, http://github.com/xxx/new-project


9. Update files

# Vi readme

Automatic commit to change files

# Git commit-

Update to remote

# Git push origin master


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.