GitHub Learning: How to upload a project from the local github&& how to copy the GitHub project through clone, detailed tutorial

Source: Internet
Author: User

First step---Sign up for a GitHub account

Start by creating an account on GitHub and you can register an account with the official website.

Premise: Install a git locally

I Github:https://github.com/saucxs

Second, git installation

: http://msysgit.github.io/

Two, second step---generate the private key and secret key

Because the transfer between the local git repository and the GitHub repository is encrypted via SSH, a private key and a key are generated locally

1. Create an SSH key locally

$ ssh---"[Email protected]"
Note: [email protected] changed to your GitHub registered mailbox, then asked to confirm the path and enter the password, we use the default one-way return to the line. Successful words will be generated in the ~/ next .ssh folder, go in, open id_rsa.pub , copy inside key .

Can not set the password, always press the return on the line

Third Step---View the private key and secret key

The fourth step---Open the id_rsa.pub file, copy the contents of the paste to the location specified by GitHub, follow the steps below to add a public key

Copy, paste in place below, generate a public key.

Public

Verify that the Ssh-key is created locally and is successful. If successful appears, it indicates that GitHub has been successfully connected.

Input

-T [email protected].  COM  

Upload the local warehouse to GitHub.

1. You will need to set up username and email before this, as GitHub will record them each time they submit

--Global user.  "Your name"--global user.  "[Email protected]"

Then the above command, continue to enter the above two commands.

2. Create a new project on GitHub.

This page appears as shown in

Then your new GitHub project, BPS1, succeeds. As shown

3, in the local upload warehouse, right-click Git Bash, add remote address

$ git Remote add origin [email protected].  COM:yourName/yourrepo.  git       

The following yourname and Yourrepo indicate your github username and the new warehouse that was just on GitHub.

4. In the warehouse to be uploaded locally, then enter the following on the command line after 2.

Https://github.com/saucxs/BPS.git

The red part is the HTTPS address on GitHub.

Then in the local repository folder, a Readme file appears.

5. Copy the project files that you need to upload here.

6, follow the command step

(1) Git init

Initialization

(2) Git status

Get the current status of the folder now

(3) git add personal-recommendation-system

The Scarlet Letter section is the folder name to upload

(4) Git status

Gets the current state, which is changed from just red to green.

(5) Git commit-m " submit message "

The red part of the information is the submission information that you can add casually.

(6) Git push Origin master

Upload to Server

(7) Pop-up a GitHub login page, enter the GitHub user name and password

Then enter the user name and password again on the command line. Then upload to GitHub on completion.

Ps:

1. Basic commands for local use

Behavior Command Notes
Initialization Init Initialize the Git repository in the local current directory
Clone address Copy a warehouse (repository) from an address on the network to a local
View current status Status View the status of the current warehouse. If you don't know what to do when you encounter a problem, you can solve the problem by looking at the hints it gives.
View different Diff View the different places between the current status and the latest commit
Diff version number 1 version number 2 See the different places between the two specified versions. The version number here refers to the commit hash value.
Add File Add-a It's pretty generic. Add the first before commit
To withdraw something from the stage Checkout--. Here, the decimal point is used to recall all changes, and -- there are spaces before and after
Submit Commit-m "Submit Information" Submitting information best reflects what has changed
Delete an tracked Clean-xf Delete any files that have been track in the current directory. Whether it is the folder and the file specified in the. gitignore file
View Commit Record Log View the current version and previous commit record
Reflog change history of Head
Version fallback Reset--hard Version number Fallback to the version of the specified version number, after which modifications are removed. It is also back to the latest version through this command. Requires Reflog coordination

2. Commands for remote warehouses

Behavior Command Notes
Set User name Config--global user.name "Your user name"
Set up a mailbox Config--global user.email "your Mailbox"
Generate SSH Key Ssh-keygen-t rsa-c "Your Mailbox" No git in front of this command.
Add a remote repository Remote add origin you copy the address Set origin
Upload and specify the default Push-u Origin Master Specify Origin as the default host, after which the push is uploaded by default to Origin
Submit to Remote Repository Push Commits the added commit of the current branch to the remote repository
Synchronizing from a remote repository Pull Get a commit for a remote repository when the local version is lower than the remote repository version

3. Better understanding of Git

Reference: Liao Xuefeng website http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/ 0013745374151782eb658c5a5ca454eaa451661275886c6000

GitHub Learning: How to upload a project from the local github&& how to copy the GitHub project through clone, detailed tutorial

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.