Uploading local files to GitHub

Source: Internet
Author: User

1. GitHub Online Upload Folder

Online upload can also upload the complete folder structure, directly dragged to the Upload File page box.

1.1 Click to upload a file

Click Upload

1.2 Direct drag
Simply drag and drop files in folders and folders. If you click Choose your files, you can only upload individual files.

Direct drag

2. Upload a local folder via the Git tool (local project)

2.1 Download Git tools

Select the corresponding version to download

2.2 After the download is complete, note that you can choose to create a desktop shortcut during the installation process

2.3 Binding Users
Open Git-bash.exe (right-click directly on the desktop, or click the Start button to find Git bash)

Enter the following command (user and mailbox for your GitHub registered account and email) in an open git bash

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

2.4 Setting SSH key (what does Sshkey do in git?) )

2.4.1 Generate SSH Key

First check whether the key has been generated cd ~/.ssh , if the returned LS has 3 files, then the key has been generated.

Key generation

If there is no key, the

$ ssh-keygen -t rsa -C "[email protected]"

Generated, the process of generating a 3-time enter the return. (default path, default no password login)
After the build succeeds, go to the corresponding directory C:\Users.ssh, open id_rsa.pub with Notepad, get SSH key public key.

SSH key Public key

2.4.2 Configuring SSH key for GitHub account
Switch to GitHub, expand the small triangle of your profile picture, click Settings, then open the SSH keys menu, click Add SSH key to add the key, and fill in the title (preferably in accordance with the local repository).

Then paste the key in the Id_rsa.pub file to this, and then add key to generate the key.

2.5 uploading local items to GitHub

2.5.1 Creating a local project

This is a few folders and files that I created myself.

Local projects

2.5.2 Building a local warehouse

    1. First go to the IMGs folder
cd F:\Github\imgs

    1. Execution Instructions:git init

After the initialization is successful you will find a hidden folder in the project. Git

    1. Execution Instructions:git add .
      Add all files to the warehouse

    2. Execution Instructions:git commit -m "提交文件"
      Inside the double quotes is the commit comment.

2.5.3 Associated GitHub Warehouse

    1. Copy warehouse address to GitHub IMGs Warehouse

    2. Execution Instructions:git remote add origin https://github.com/hank-leo/imgs.git

    3. You can merge the code with the following command: Pull=fetch+merge

      git pull --rebase origin master

    4. After executing the above code, you can see that the local code base has more readme.md files

2.5.4 uploading Local Code
Execution Instructions:git push -u origin master

2.5.5 finished.

You can see that our local project has been uploaded to GitHub.

Completed the
Note: Git cannot manage empty folders, and folders must have files to upload.

Turn from 72772660

Uploading local files 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.