一 首先在Github新建一个仓库,回到首页,点击右上角的New repository新建仓库。
二 在本地依次使用下面命令
…or create a new repository on the command line
echo "# opus" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/DyLanCao/opus.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin https://github.com/DyLanCao/opus.git
git push -u origin master
三 问题
1 输入:
git remote add origin https://github.com/DyLanCao/opus.git
上报错误:fatal: remote origin already exists.
解决方法:
首先:git remote rm origin
然后再使用命令:git remote add origin https://github.com/DyLanCao/opus.git