本地项目上传到github

  1. 在你的项目根目录下打开git
    2.git init
    3.git add .
    //添加上传的文件(所有的)
    4.git commit -m "描述(比如:第一次像远程仓库提交我的代码)"
    //提交上传的文件
    5.git remote add origin 你的仓库地址
    6.git remote set-url origin https://<你的token>@github.com/<你的名字>/<项目名>.git
    //与远程的仓库建立连接
    7.git push -u origin master
    //把提交在本地仓库的文件上传到远程git仓库

8.如果提示:
error: failed to push some refs to 'https://github.com/zgscmt/uni-test.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

git pull --rebase origin master

9.git push -u origin master

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容