针对Github远程空仓库
本方法适用于Github远程空仓库
空仓库即在Github新建仓库时,没有选择添加README.md
、LICENSE
、.gitignore
其中任何文件,细分为以下几种情况:
- create a new repository on the command line
echo "# 你的仓库名" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/xxx/xxx.git
git push -u origin main
- push an existing repository from the command line
echo "# 你的仓库名" >> README.md
git remote add origin https://github.com/xxx/xxx.git
git branch -M main
git push -u origin main
- import code from another repository
新建仓库后点击下面的import code
即可