Introduction: a brief introduction to the local file using git pushed to Github / Gitee
Proceed as follows:
0. create the repository
Whether Github or Gitee, must create the appropriate warehouse (repository) before uploading files
1. Open the git bash
The need to upload a local folder open right git bash:
2.git init
Enter the git init command, create a local repository in the folder:
3.git add .
Enter the git add. Command, add all the files in that folder to a local warehouse. "." Is to add all files can. "" Replaced with the corresponding file name if you want to add individual files.
4.git commit -m "comment"
Enter git commit -m "first update" command, git commit -m (file that is added in one step on) role for the submission of documents staging area, you can fill annotation information on the submission within double quotes back, here is written, " first update ".
5.git remote add origin remote warehouse address
Enter the Add Remote Origin git https://github.com/AhuntSun/JavaScript-.git or
the Add Remote Origin git https://gitee.com/ahuntsun/Test.git instructions associated with the remote repository local repository, instruction behind the address Github / Gitee the address of the original target warehouse or warehouse just created. Next to the warehouse on Gitee example.
6.git pull --rebase origin master
Enter git pull --rebase origin master instruction, the contents of the remote repository into a local warehouse. If a remote warehouse is empty you can skip this step if the remote repository is not empty, it must be this step, otherwise it will error.
7.git push -u origin master
Enter git push -u origin master instruction, the local repository of files pushed to the remote repository master branch has been established in association.
After command execution can ask to see a local file upload in a remote repository:
If the remote repository is not empty, and no step 6, the following error occurs when executing instructions Step 7:
8.git status
Finally git status command input can view the status of the local repository, this step can be omitted.
Github push files sent is the same step.
As long as the establishment of a local warehouse associated with the remote repository folder, and then upload the files within that folder only need to enter the command to step 3,4,7.