本地项目上传到github
2017-12-19 18:22
225 查看
1.安装Git
在Windows上安装Git,可以从Git官网直接下载安装程序下载地址:https://git-scm.com/download/win
2.创建版本库
cd /e/git-repository/learngit git init
3.将本地项目工作区的所有文件添加到暂存区
git add .
4.将暂存区的文件提交到本地仓库
git commit -m "注释"
5.git status 查看仓库的状态
6.将本地仓库关联到Github上
git remote add origin GitHub仓库地址
7.将代码由本地仓库上传到Github远程仓库
git pull --rebase origin master//(不加这句可能报错出现错误的主要原因是github中的README.md文件不在本地代码目录中,可以通过该命令进行代码合并) git push -u origin master
8.Github远程仓库修改之后,可以用git pull同步到本地
git pull命令用于从另一个存储库或本地分支获取并集成(整合)。git pull命令的作用是:取回远程主机某个分支的更新,再与本地的指定分支合并,它的完整格式稍稍有点复杂。9.远程同步
# 下载远程仓库的所有变动 $ git fetch [remote] # 显示所有远程仓库 $ git remote -v # 显示某个远程仓库的信息 $ git remote show [remote] # 增加一个新的远程仓库,并命名 $ git remote add [shortname]
# 取回远程仓库的变化,并与本地分支合并
$ git pull [remote] [branch]
# 上传本地指定分支到远程仓库
$ git push [remote] [branch]
# 强行推送当前分支到远程仓库,即使有冲突
$ git push [remote] --force
# 推送所有分支到远程仓库
$ git push [remote] --all[/code]
详细参考:[url=https://git-scm.com/book/zh/v1/Git-%E5%9F%BA%E7%A1%80]https://git-scm.com/book/zh/v1/Git-%E5%9F%BA%E7%A1%80
相关文章推荐
- 如何通过Git GUI将自己本地的项目上传至Github
- 本地项目上传到github的方法
- 上传本地项目到github上
- git命令将本地项目上传到github
- 如何通过Git GUI将自己本地的项目上传至Github
- 将本地项目上传至GitHub上
- github入门到上传本地项目
- ubuntu下将本地项目上传到github托管
- github上传本地项目
- 上传本地项目代码到github
- ubuntu系统github上传本地项目
- 将本地项目上传到github上的操作步骤
- github上传本地项目
- git 上传本地项目到github以及遇到的一些问题
- (Git的应用)本地库项目上传到github
- 上传本地项目到github
- 怎样用sourceTree将自己本地的项目上传到github网站上
- 创建github项目clone到本地并上传到github上简单步骤
- 如何将本地项目上传到GitHub
- 上传本地项目到github