Uploading local items to GitHub

Source: Internet
Author: User

Mailbox settings

All git instructions are based on the user's mailbox to identify the user, so before executing any git command, we should set all the GIT instructions for the user mailbox what is it?

1. Tell GitHub to make sure your mailbox is private and not public.

Login to GitHub, go to Home, click Setting options


Go to the Email Settings page and select



2. Tell GitHub your e-mail address

First, you can verify what your email address is at the moment. Open a Command window and enter the following command



Set your own e-mail address in the format GitHub user name @users.noreply.github.com



SSH security verification 1. Creating SSH

Uploading the code to GitHub requires authorization, we must authorize the current user to use the computer, have access to your GitHub account, and GitHub uses SSH for authorization, i.e. we need a private key and a public key. So how do we do it?


Open terminal, enter the command, note the replacement email address for the email address you just set


The terminal then prompts "Do you want to use the default location to store SSH keys?" ", you press the ENTER key directly to indicate the use of the default path


Then, prompt to set the security password, can set a password arbitrarily



2. Add SSH private key to Ssh-agent

After getting to SSH key, we need to add its private key to the ssh-agent inside


First, you need to make sure that ssh-agent is available.


Then, add the private key of the SSH key you just generated to ssh-agent, note that "~/.ssh/id_rsa" represents the location where the private key of SSH key is stored, this is a default location, and if you do not change the default location when you make SSH key in the previous step, use it directly. "~/.ssh/id_rsa"



3.github Adding a public key

After the steps above, we created SSH key and added the private key to Ssh-agent, and then we need to tell GitHub the public key.


Copy the contents of the public key file to the Clipboard. Note that "~/.ssh/id_rsa.pub" is the default path to the public key, and if the SSH key is produced, the path is not changed and can be used directly


Then, open the homepage of GitHub and go to the setting->>ssh and GPG keys page. Create a new SSH key and copy the contents of the Clipboard into the key text box



Warehousing creation

Once the authorization is successful, we can create the warehouse and then upload the code into the warehouse.


Create a warehouse. Go to Home, click the New Repository button


Enter the name of the repository


Warehouse creation Success, note that the line is the Remote Storage address, we need to use it later.



Uploading items to GitHub

A remote Storage was created on GitHub, and we need to clone the remote repository locally before we can upload the project code to the remote repository. The address is the address where you just created the warehouse. Where are the cloned storage locations stored locally? is where the current command execution is located. We can view the current working directory by entering the command PWD in the terminal


Then, take the project you want to upload to GitHub (note, delete the git files that are in the project, or there will be a conflict). After the copy succeeds, enter the following command at the terminal to enter the local managed directory (just the storage location of the local storage cloned from remote Storage).


Add changes to the version manager


Submitted to the local version control repository, the quotation marks are your instructions for this submission.


Submit your local repository to your GitHub account



After all the steps above, back to GitHub, you can see that the project has been uploaded successfully

Reference documents

Keeping your email address private

Generating a new SSH key and adding it to the ssh-agent

Adding a new SSH key to your GitHub account

Teach you the simplest open source project hosting GitHub Getting Started tutorial

Uploading local items to 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.