Introduction
This article describes how to upload local files to the gitee repository.
The git tool is used. It can be downloaded and installed at the following address. Git download address
Note:
1. For the first use, you need to configure the git user information and connect the computer with the key of gitee.
2. The local warehouse refers to the folder where the git. folder is located, and the last uploaded content is also the content in this folder , that is, except for the contents of the git. folder
command used
- git init initialization, create a local warehouse
- git add . Add to local repository
- git commit -m "comments" add comments
- git remote add origin warehouse address to connect to remote warehouse
- git pull --rebase origin master Synchronize warehouse content
- git push -u origin master upload to the remote warehouse
process:
1. Create a folder first, and put the uploaded folder data into the new folder
2. Enter the folder, right-click Git Bash Here, and enter the git interface
As shown in the picture:
3. Configuration information (configuration is required for the first use)
git config --global user.name "name"
git config --global user.email "email"
as the picture shows:
4. Generate a key
Continue to enter the following command, email is the above mailbox
ssh-keygen -t rsa -C “email”
Press Enter twice between inputs and press Y until the image appears, which is the dotted box, the red part
You can use the following command to view the key:
cat ~/.ssh/id_rsa.pub
Select the key, right-click the mouse, and copy it
5. Connect to gitee
Enter gitee settings
6. Click SSH public key
Paste the key you just copied in, click OK, and enter the gitee account password
7. Initialize and create a local warehouse
entergit init
A .git folder will be generated. If you can't see it, set it in the folder view
Add local files to local repository
Input git add .
, add all the files under this folder to the local warehouse, note that there is a space between add and . "." means to add all files. If you want to add individual files, you can replace "." with the corresponding file name.
8. Add comments
Input git commit -m "注释"
, git commit -m is used to submit the file in the temporary storage area (that is, the file added in the previous step), and the comment information about the submission can be filled in the subsequent double quotation marks.
9. Add remote warehouse
Copy warehouse address
Enter the git remote add origin
https://gitee.com/hard-working-sang_admin/szw command to establish the association between the local warehouse and the remote warehouse, and the address after the command is the address of the warehouse.
10. Synchronize warehouse content
Enter git pull --rebase origin master
the command to merge the contents of the remote warehouse into the local warehouse. If the remote warehouse is empty, this step can be skipped. If the remote warehouse is not empty, this step must be performed, otherwise an error will be reported.
At this time, the contents of the local warehouse and the remote warehouse are the same
11. Upload files
Enter git push -u origin master
the command to push the files in the local warehouse to the associated remote warehouse master branch.
then just wait