Preface: Want to upload a local project to GitHub management, so here to record, convenient later.
The first step, create a warehouse on GitHub
The second step, go to the local repository, execute the GIT init command, this will be more than the. git folder.
The third step, in order to upload the local warehouse to GitHub, also need to configure SSH key.
$ ssh-keygen-t rsa-c "[Email protected]"
Direct to enter, here is the description will be generated on the default file Id_rsa ssh key.
Here the system requires a password, directly press ENTER to indicate that no password is set. Repeat the password is also a direct carriage return, after prompting you shh key has been generated successfully.
Fourth step, then we go to the prompt address under View SSH key file. My computer's address is c/users/administrator/.ssh/id_rsa.pub.
Open the Id_rsa.pub and copy the key inside. The key inside is a pair of characters that can not understand the combination of numbers, do not control it, directly copied.
Back to GitHub website, go to account Settings, choose ssh and GPG keys,new ssh Key on the left
Title fill, paste key.
After saving, verify success, enter in Git bash
$ ssh-t [email protected]
Enter will see: You've successfully authenticated, but GitHub does not provide shell access. This means that you have successfully connected to GitHub.
The fifth step, the next thing we need to do is to upload the local repository to GitHub, before you have to set up username and email, because GitHub every commit will record their
$ git config--global user.name "your name" $ git config--global user.email "[Email protected]"
Sixth step, go to the local Repository (folder), right-click Git Bash, add remote address
$ git Remote add origin [email protected]:yourname/yourrepo.git
Seventh step, finally, submit the code, upload
git Add. which. Represent all Files
The first time you upload the code, initialize the project, so you need to create a new branch master, or you will get an error.
The eighth step, on GitHub, looks like this, then you can start to maintain the warehouse.
Uploading local items to GitHub