如何初始化一个线上的GitHub仓库,在本地已有的仓库中上传到线上,
首先,先创建一个线上的仓库
本地有一个曾经的仓库,或者本地git init创建一个本地仓库
根据线上仓库的主页给的提示代码进行上传
代码如下:
...or create a new repository on the command line
bash
echo "# lyf0801.github.io" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:lyf0801/lyf0801.github.io.git
git push -u origin main
...or push an existing repository from the command line
bash
git remote add origin git@github.com:lyf0801/lyf0801.github.io.git
git branch -M main
git push -u origin main