把本地项目上传到github仓库的两种方法。

方法1.在github上创建仓库以后,根据 git clone  {你的github仓库地址} 把远程仓库克隆到本地文件夹下,然后把本地项目复制到该文件夹,再通过git add, git commit, git push上传到远程即可。

方法2.在github上创建远程仓库以后,在本地项目文件夹下,执行git init初始化本地仓库,然后git remote add origin {你的远程仓库地址} 关联远程仓库,然后git add, git commit, git push -u origin master 上传到远程。如果出现Updates were rejected because the tip of your current branch is behind直接使用git push -f origin master即可。

posted @ 2018-05-20 19:10  董永辉Bruno  阅读(468)  评论(0编辑  收藏  举报