本地代码上传至github

5次阅读

共计 505 个字符,预计需要花费 2 分钟才能阅读完成。

1.github 上操作:在 git 上建立好仓库之后,可获取到.git 地址,创建过程略,
可参考 https://blog.csdn.net/cnjy_/a…

2. 本地电脑上操作:
进入你要上传的文件夹,git init,此时会出现隐藏文件夹.git

接着输入命令:
// 将项目添加到仓库
git add .
// 将项目提交到仓库
git commit -m "xxx"
// 将本地文件夹与 github 仓库关联
git remote add origin https://github.com/wangqyuan/wqy-data-handle.git
// 关联好之后就是讲文件 push 到 github 上了
git push origin master

注意:

如果 push 报错:error: src refspec master does not match any
引起该错误的原因是,目录中没有文件,空目录是不能提交上去的

解决方案:创建一个 readme.md 文件并提交,就可以 push 成功了
touch README
git add README
git commit -m 'xxx'
git push origin master
可参考:https://blog.csdn.net/xl_lx/a…

正文完
 0