使用Git提交本地仓库至Github远程空仓库流程

针对Github远程空仓库

本方法适用于Github远程空仓库

空仓库即在Github新建仓库时,没有选择添加README.mdLICENSE.gitignore其中任何文件,细分为以下几种情况:

  1. 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

  1. 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

  1. import code from another repository

新建仓库后点击下面的import code即可

猜你喜欢

转载自blog.csdn.net/qq_45510888/article/details/130285913