Upload code to GitHub on Mac

Source: Internet
Author: User
Tags git client

Preface

Sometimes we will write some small programs to learn new knowledge, but after the end of time may forget, the best way is to find the original code to take a look. The code can now be hosted on some websites for free, the most famous non-GitHub,

This process is recorded today, for the convenience of other students and their own view

Steps
    • one   create a github account
    • two Install the GIT client (because the Mac and Linux comes with, Windows classmates please go cry for five minutes)
    • three   create ssh           local code and GitHub warehouse connector
    • Span style= "font-family:"courier New", Courier; Font-size:16px "> four   using the secret key to connect to GitHub
    • five   create a project
    • six   uploading code to GitHub

Create a GitHub account

Open Official Website: https://github.com Click " Sign Up"

Three Create SSH
Open the terminal (well, I'm sure you'll know where):

$CD ~/.ssh  //Check if SSH is already present

If present, consider using an existing

If it does not exist, the default parameters directly generated SSH, all the way to the return can be done, but I believe that most people already have this directory.

generate secret key:
SSH-KEYGEN-T rsa-c [email protected]               ( email is GitHub's registered email )

 

So the secret key is generated.

Four using the secret key to connect to GitHub

add ssh to GitHub, such as :
    • Login to GitHub, select Account settings-->ssh Keys to add SSH
    • Title:[email protected] (this can be filled out, recommended mailbox OH)
    • Key: Open the Id_rsa.pub file you generated and copy the contents to this point.

When you're done, remember to verify the secret:input Command
ssh-t [email protected]

Return to the following to represent success

Hi xiaogangfan! You've successfully authenticated, but GitHub does not provide shell access.

If there is no return, please click here for the reason why the query failed

Create a project on five GitHub

Click on "New respository"

Enter "Repository name"

Address: [Email protected]:xiaogangfan/vaidation.git

Six local upload code to GitHub

GIT init//Initialize local repository git Add.   Put the code in the commit area git commit-m "commit"//submit to the repository and write some comments-m for Comments git remote add origin [email protected]:xiaogangfan/ Vaidation.git//Connect to the remote repository and build an alias named: Origin git pull--rebase [email protected]:xiaogangfan/vaidation.git  //Update git Push-u Origin Master//Submit the contents of the local repository to the address where the address is origin, under Master branch

That's it.

Upload code to GitHub on Mac

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.