1. Configure account information
# 邮箱
git config --global user.email "YourEmailAddress"
# 账户名
git config --global user.name "YourName"
2. Create a new warehouse
clickNew repository
Enter the relevant information (the warehouse name is taken as myRepo
an example), and then clickCreate repository
3. Initialization
Run in the root directory of the local project to generate local git management
git init
4. Add the files to be uploaded
If you want to upload all files in the current directory, run
git add .
5. Submit
The git commit command adds the content of the staging area to the local warehouse.
-m
The following content can be some remark information
git commit -m "first commit"
6. View submission status
You git status
can view the submission status of the current warehouse with
git status
The above output shows that we have not made any changes since the last submission, which is a "working directory clean", which translates to a clean working directory.
7. Add remote repository
clicksettings
clickDeveloper settings
CreatePersonal access tokens
After ticking , repo、workflow
etc. Generate token
, click to complete the creation, and find a safe place to save the generated ones token
. After closing this page, you will never see it again.
Add remote repository
git remote add origin https://[email protected]/yourName/myRepo.git
- yourToken: the token just generated
- yourName: account name
- myRepo: warehouse name
Run git remote -v
to view all remote warehouses
8. Upload project
Enter git push -u origin master
, upload the code to the github warehouse
git push -u origin master
Check whether the project has been uploaded on github
success!