1. new Create a new warehouse
Complete/tick the three sections below
2. Right-click the local file to be uploaded, and select "Git Bash Here" to enter.
Enter the git interface:
Third, enter the following commands in turn
1. Generate readme file.
echo "# 在这里填入readme里面的内容" >> README.md
2. Create a local warehouse and initialize the version library.
git init
3. Add the file to the local repository.
git add .
4. Submit to the local cache area, and the quotation marks are comments, which are used to explain what was submitted.
git commit -m "填写备注"
5. Submit the code of the local warehouse to the remote github warehouse.
git remove add origin 此处填写自己新建的github仓库地址
GitHub warehouse address:
Code example:
6. Push the code of the remote warehouse to the master branch.
git push -u origin master
Enter your own warehouse on github, refresh, and you can see the successfully uploaded files:
Fourth, modify the master to default
If main is the default, but we want to set the master as the default, we can do the following:
the default will become the master branch:
other
1. Note: When using Git for the first time, a window will pop up asking you to log in. Don't click "Sign in with your browser", it's easy to make mistakes. If an error occurs after clicking, the following codes can be executed in sequence:
git remote remove origin
Then retype:
git remote add origin https://github.com/CZH-qm/BMI.git
git push -u origin master
Then click "Sign in with a code" this time, and enter your git password in the next step.
2. Check your git username:
git config user.name
Check your git password:
git config user.password
Set your own git password:
git config --global user.password "xxxxxxx"
If you just set your own git password, and then execute the follow-up command, an error will be reported: "fatal: unable to access 'https://github.com/CZH-qm/BMI.git/': Failed to connect to github.com port 443 after 21040 ms: Couldn't connect to server"
as shown in the figure:
then enter the following codes in sequence:
git config --global --unset http.proxy
git config --global --unset https.proxy
Then execute "git push -u origin master" and it will be OK.