[Git commit] Push the local project to github

Push the local project to github

1. Create a new repository

在github上新建一个repository ,并复制仓库地址

2. Initialize the project

Right-click the local project to be pushed ==> git bash here, and initialize

git init

3. Push to remote warehouse

git remote add origin <github仓库路径>

4. Pull the warehouse on the code cloud to the local folder

git pull origin master

5. Push the file to the staging area

git add  . 

6. Enter the submission information

git commit -m "init"  

7. Push to the githubmaster repository

git push origin master

8. Switch to the master branch

git checkout master

9. Forcibly rename the master branch to the main branch

 git checkout main

10. Switch branch to main

git branch main master -f

11. Force push the local main branch to the remote library and overwrite the content of the remote main branch

git push origin main -f 

Guess you like

Origin blog.csdn.net/weixin_43853746/article/details/121728692