This operation needs to use the management tool git,:https://git-scm.com/
Once installed, open the project folder you want to upload, right-click on the Windows system select Git Bash here
The transfer between 1.git and GitHub is encrypted via SSH, so the first step is to generate one locally. SSH (there is not much explanation for the GitHub registration steps here).
1) First check if there is a. ssh file on the local, and some delete it.
$ CD ~/.ssh
2) Enter the command, generate. SSH, write your own mailbox
$ ssh-keygen-t rsa-c "Your [email protected]"
You can go straight to the carriage
This means that a. ssh file will be generated at the root of the user directory in the C drive, and if you can't find it, you can search for it, and there will be Id_rsa and Id_rsa.pug files under the file.
3) In order to avoid errors when creating a connection with GitHub, you can create a new config file and copy the following code in
Host github.com User git Hostname ssh.github.com preferredauthentications publickey identityfile ~/ . Ssh/id_rsa Port 443
2. Add a public key to GitHub
1) Copy the contents of the Id_rsa.pug to the specified location
2) test the connection is successful, indicating successful access
$ ssh-t [email protected]
3. Uploading a project
1) Create git config file, you will find a. git file under your file, default is hidden file
$ git init
2) Add all current files to GitHub
3) Confirm Add
$ git commit-m "first commit"
4) Execute the command, and copy back the generated on your GitHub
$ git Remote add origin [email protected]:heshaui/pdfjsdemo.git
May be wrong
Workaround:
First enter: $ git Remote RM origin
Re-enter: $ git Remote add origin [email protected]:heshaui/pdfjsdemo.git
5) Execute last command
$ Git push-u Origin Master
If you use Git to push the source code to GitHub, you may get an error, as follows
The main reason for the error is that the readme.md file in GitHub is not in the local code directory
You can merge the code with the following command: Pull=fetch+merge
Git pull--rebase Origin master
After executing the above code, you can see that the local code base has more readme.md files
Now execute the statement GIT push-u Origin master to complete the code upload to GitHub
So the project was uploaded successfully.
Upload local code to GitHub