One, download the git client http://git-scm.com/download/
2. Create git account information
1 git config --global user.name "shulonghu"
git config --global user.email
3. Set up SSH Key for Github account
First check whether the key has been generated cd ~/.ssh, if there are 3 files in ls, the key has been generated, id_rsa.pub is the public key
If it is not generated, then generate it by $ ssh-keygen -t rsa -C "[email protected]".
1) It is the path confirmation, just press Enter to save the default path
2) Press the Enter key directly, here we do not use a password to log in, it is too troublesome to use a password;
3) Direct Enter key
Four common command sequences for git submission warehouses
The instructions for git to create a repository are as follows
git init //Turn this directory into a repository that git can manage
git add . //Add the file to the repository
git commit -m "comment description" // put the file on the warehouse
git remote add origin [email protected]:DragonTigerShu/file name//Associate the remote warehouse
git push -u origin master // Put all the content of the local library on the library
5. Log in to the github account
1 Click new repository to create a new repository. Add Rrpository name Add description information Description
Click to create Create repository to complete the display of the repository home page
2 After that, it is very important to obtain the address of the remote repository
3 Then open Gitbash
Switch to the helloworld project directory and clone the remote repository to the local
Sometimes the transmission times out. . Just try again. .
4 After ls -al view the project directory delete the file name created in the directory
5 git push origin mster is very important to synchronously submit this
*Note that an error will be reported if the submission fails
solution
1 First execute the execution in the current directory
git push -u origin master
2 If there is still no solution, there must be a README.md file in the directory and then merged
Execute git pull --rebase origin master
3 Execute a git push -u origin master again to complete the upload to github
4 Check your account to see it.