There are two ways to upload a project to GitHub
One, GitHub online upload folder
Online upload can also upload the complete folder structure, directly dragged to the Upload File page box.
Click Upload File
Simply drag and drop files in folders and folders. If you click Choose your files, you can only upload individual files.
Second, upload a local project via the Git tool
For some introduction to git and github please see my other article what is GitHub?
1. Install git
2. 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"gyl-coder"--global"[ Email protected]"
3. Set SSH key
3.1 The role of SSH key in Git?
SSH is an encrypted transmission.
There are many algorithms for encrypting transmission, and one of the core problems that git can use Rsa,rsa is how to use a pair of specific numbers so that one of the numbers can be used for encryption, and the other can be used to decrypt the data. These two numbers are the public key that you encounter when you use Git and GitHub, and the private key.
Where the public key is the number that is used for encryption, which is why you upload it to GitHub after you have generated the public key in this machine. From GitHub, the data encrypted with that public key can be restored with your local private key.
If your key is lost, whether it is a public key or a private key, the missing one is useless, the workaround is simple, regenerate again, and then set it again in github.com.
3.2 Generate SSH Key
First check whether the key has been cd ~/.ssh
generated, and if ls
there are 3 files returned, the key has already been generated.
If there is no key, the
" [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\gyl.ssh (Gyl for the computer user name, everyone different) with Notepad open id_rsa.pub, get SSH key public key.
3.3 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.
3.4 Uploading a local project
3.4.1 Creating a local warehouse
First select a disk to create a folder (be sure to put in easy to find the place, easy to find), here I put my warehouse in the Git folder
First go to the Gyl-repository folder
CD D:\Git\gyl-repository
Next we need to set up the global user, mainly to set the user name and mailbox.
You can then move your items to that folder
Enter the project folder and execute the instructions:git init
After the initialization is successful you will find a hidden folder in the project. Git
3.4.2 Execution Instructions:git add .
Add all files to the warehouse
Execution Instructions:git commit -m "提交文件"
Inside the double quotes is the commit comment.
3.4.3 Associated GitHub Warehouse
1. Copy warehouse address to GitHub Gyl-coder Warehouse
(The figure is from the network)
2. Execution instructions:git remote add origin https://github.com/hanyuntao/text.git(这里的地址对应你的仓库地址)
The last upload code can be
Execution Instructions:git push -u origin master(这里可能会弹出两个小框框,键入你的Github帐号和密码即可)
You can see that our local project has been uploaded to GitHub.
How do I add items locally to GitHub? (Windows)