把本地项目提交到 github 上
2017-04-14 08:12
183 查看
本地项目提交到github
下列的操作,我假装你已经安装和配置好了本地git1.到本地项目的目录,输入命令行:
git init //初始化本地,会生成.git文件
2.把项目添加到本地仓库(myApp)
git add . //添加所有文件 git add readme.md //只添加文件readme
3.提交并添加本地仓库
git commit -m '这是我提交的文件'
4.在自己的github上面新建仓库(repository),并命名为myApp(与本地项目同名),然后拷贝项目地址:https://github.com/zchuhui/myApp.git
5.把本地仓库的项目提交到github上面
//添加远程地址 git remote add myapp https://github.com/zchuhui/myApp.git //推送主分支(master)到github上去 git push -u myapp master //或 //强行推送当前分支到远程仓库,即使有冲突 $ git push [remote] --force
6.大功告成,赶快去查看你的github吧
常见操作错误:
remote add 时经常会报错:==fatal: remote origin already exists.==
解决方案:输入 ==$ git remote rm origin== 再 remote add 就行了
从github上面获取项目
1.直接克隆github上的项目git clone https://github.com/zchuhui/myapp.git
2.取回远程仓库的变化,并与本地分支合并
git remote add myapp https://github.com/zchuhui/myApp.git git pull myapp
在github新建新分支
前提:该项目已经提交到github的master分支上1.在本地新建一个分支:
git branch Branch1
2.切换到你的新分支:
git checkout Branch1
3.将新分支发布在github上:
git push origin Branch1
然后,在github上项目页面设置:
setting>
Branches>
Default branch上查看默认分支。
即可看到新建的分支:
Branch1
相关文章推荐
- eclipse提交本地项目到github
- git提交本地项目到github
- 使用终端命令行将本地项目上传到Github并提交代码
- Mac Android studio提交本地项目到Github 以及配置 SSH KEY
- 将本地项目提交github
- git本地提交项目到你的github
- Github使用之将已有项目提交到Github/从Github上pull到本地
- 将已有项目提交到github/从github上pull到本地
- 借助SourceTree使用Github(四) 修改过的本地项目提交到Github
- 将已有项目提交到github/从github上pull到本地
- 使用终端命令行将本地项目上传到Github并提交代码
- 本地项目提交GitHub远程仓库
- 新手使用GitHub客户端提交本地项目到GitHub网站详细步骤
- 首次将本地项目代码提交到新建的github仓库
- Git入门介绍-3-把本地项目提交到Github
- 命令行提交本地项目到github
- 提交本地项目到github和提交更新
- 将已有项目提交到github/从github上pull到本地
- 本地项目提交github马克
- 从本地新建项目到提交到github