Uploading local projects using Git and GitHub

Source: Internet
Author: User
Tags using git

It's been a while to join GitHub, but it hasn't been very active. Write this small article one is to share some of their own experience, and second, to the brain to save a backup (after the college entrance examination after the memory brush down, maybe one day and forget ...) )。

Here are the steps to focus on Windows users.

First, the preparatory work

PS: You can directly ignore the preparation if you have already installed Git, created an SSH key, and have a GitHub account

1. Download and install git 2, the initial configuration of Git  
" Your name "  "your email"
3. Register your GitHub account 4. Create and submit SSH key

back to the desktop, right-click the mouse, open git Bash, enter the following command and enter a few

Ssh-keygen ' [email protected] ' -t RSA

Go to GitHub home-top right corner settings--ssh Keys--add SSH Key

Enter the C drive--User ——. SSH folder--open id_rsa.pub, copy contents

Paste the key content that has been copied in the input box below the Add SSH key--key-click Add key

Second, the establishment of warehouses

Login to GitHub Home--click "+" in the upper right corner--new repository--fill in the warehouse name and description, it is recommended to tick initialize this repository with a README, you can simplify the operation--click Create Repository, created successfully.

Iii. Initializing the Project

1. Locate the project root directory you want to upload to GitHub hosting, right-click Git Bash here, go to git command line, enter command

Git init

This will have a. git hidden directory in your project directory

2. Input command

git Add.

"." In the back of the add is to add all the files in the directory, or you can add specific files, such as git add somedoc.txt

3, submit to the local warehouse

' Description for this commit '

The string after Git commit-m is the description of this commit

Iv. Uploading Code
Git remote add Origin https://github.com/pursue321/100duPractice.git

After Origin is your own warehouse address, you can go to GitHub home--repository--into the created warehouse--Copy the address behind HTTPS

Git push Origin Master

If you execute git remote add Origin https://github.com/pursue321/100duPractice.git, an error occurs:

Fatal:remote origin already exists

The following statement is executed:

RM Origin

Then execute git remote add Origin https://github.com/pursue321/100duPractice.git.

If you execute GIT push Origin master, the error is:

error:failed to-push som refs to ....

The following statement is executed:

Git pull Origin Master

First pull the file above github on the remote server, then execute GIT push Origin master

Uploading local projects using Git and GitHub

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.