Push the local warehouse to github

1. When there is no local warehouse – upload to the remote warehouse

0. First create a new warehouse on github

Note: Do not choose to automatically generate the readme.md file

1. https version

cd xx项目
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/username/xxx.git
git push -u origin main

2. git version (ie: uploaded ssh key)

cd xx项目
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin [email protected]:username/xxx.git
git push -u origin main

2. When there is a local warehouse – push and associate it to the remote warehouse

https version

git remote add origin https://github.com/username/xxx.git
git branch -M main
git push -u origin main

git version

git remote add origin [email protected]:username/xxx.git
git branch -M main
git push -u origin main

Guess you like

Origin blog.csdn.net/SweetHeartHuaZai/article/details/130600899
Recommended