GitHub uploads Local Files

Source: Internet
Author: User

basic Condition: Installation GitHub, after the installation is successful; (Windows System)

1, after the installation is complete, also need a step setting, in the command line input:

$ git config--global user.name "Your name"

$ git config--global user.email "[email protected]"

2. configuring The Ssh public key

a)   Check if this machine has Ssh key settings: $ CD ~/.SSH  or cd .ssh (if not, prompt:  no such file or directory ~/.ssh Path ( ls View current path file, RM *  delete all files)

b) Generate key: $ ssh-keygen-t rsa-c "[email protected]" got two files:Id_rsa and Id_rsa.pub.

c) Add the ssh key on GitHub , which is to addthe public key in "id_rsa.pub".

d) Open GitHuband find setting->ssh Choose Add an SSH,title Write (preferably known) and Copy the contents of the id_rsa.pub to the box in the title .

(You only need to use it for the first time)

3. Create a version library

find the right place to create an empty directory (right-click -Git Bash) and enter the command:

mkdir learngit(file name)

CD Learngit

PWD (pwd command is used to display the current directory, can not be written)

4. use git init command to become a repository managed by git

Git init

At this Git has built the warehouse and told you it's an empty repository (emptygit repository)

5. Add files to the warehouse

Copy the file you want to upload into the folder Learngit , and then execute the command

git Add. ( . represents all files in the Add folder)

No display after execution, indicating correct.

6. Use the command git commit to tell gittosubmit the file to the repository

Git commit-m "First commit"

(can be written in quotation marks, where the content is a description, such as this is the first time to submit)

7. Create a remote repository

Login GitHub, find the "newRepository" button in the top right corner, create a new warehouse, fill in the name (learngit), and click Create.

8. according to GitHub tips, run the command under the local learngit Warehouse:

Git remote add Origin [email protected]: Flower-qh/learngit.git

(flower-qh is your own GitHub account name)

9. Push all the contents of the local library to the remote library and execute the command:

Git push-u Origin Master

10, (the second way) from the remote library cloning

First, login GitHub, create a new warehouse, named xxx

We tick Initialize this repository with a README, so GitHub will automatically create a readme.md file for us. Once created, you can see the readme.md file

Then, clone a local library with the command git clone

git clone [email protected]: Michaelliao/xxx.git

Finally, execute the 5,6,11.

GitHub uploads Local Files

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.