本地上传项目至github
现在大家都习惯了通过IDEA直接生成项目结构,那么如何把这个项目结构上传至GITHUB呢 ?
github 提供了3种方案,这里写2种 。还一种是github上的入口进行上传。
1、create a new repository on the command line
echo "# demo" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/xuboHaven/demo.git
git push -u origin main
2、push an existing repository from the command line
git remote add origin https://github.com/xuboHaven/demo.git
git branch -M main
git push -u origin main
示例
本地通过IDEA创建springboot结构的项目demo .

找到demo文件夹右键开启git bash ,输入1中指令,再看github项目结构

如果github上本来就有一个repository,那么省却git remote add即可。

浙公网安备 33010602011771号