本地代码导入github仓库
来源:互联网 发布:python 卸载模块 编辑:程序博客网 时间:2024/06/05 02:34
问题背景
直接clone github代码库很容易,要是将本地已经存在的git仓库放到github上,这个又该如何操作呢?
这篇文章针对该问题进行说明。通过本文,您将知道如何将本地已经存在N多git记录的代码仓库 方便放到github上。
本地仓库
本地代码创建git库,容易,直接git init.
然后提交记录,这里我以 Ionic官网 的todo Project为例进行说明。
todo目录结构
Mode LastWriteTime Length Name---- ------------- ------ ----d----- 2015/11/16 11:42 .idead----- 2015/11/16 11:36 hooksd----- 2015/11/16 11:47 platformsd----- 2015/11/16 11:47 pluginsd----- 2015/11/16 11:47 resourcesd----- 2015/11/16 11:36 scssd----- 2015/11/16 16:48 www-a---- 2015/11/16 11:36 29 .bowerrc-a---- 2015/11/16 11:36 242 .editorconfig-a---- 2015/11/16 11:36 138 .gitignore-a---- 2015/11/16 11:36 118 bower.json-a---- 2015/11/16 11:47 2649 config.xml-a---- 2015/11/16 11:36 1385 gulpfile.js-a---- 2015/11/16 11:37 37 ionic.project-a---- 2015/11/16 11:47 609 package.json
其中 www/ 以及 .gitignore 是需要加入到git仓库中,其他暂时不用加入。
git如何忽略文件
这里插播题外话:git如何忽略文件 方法简单。
在.gitignore中加入不需要trace的文件夹或文件即可。
在本文实例中 .gitignore内容如下:
platforms/plugins/.bowerrc.editorconfigbower.jsonconfig.xmlgulpfile.jshooks/ionic.projectpackage.jsonresources/scss/.idea/
在 www 中添加必要文件以及git init, git add, git commit后。
查看此时的git log,如下:
PS E:\Web-DEV\Ionic\todo> git logWARNING: terminal is not fully functionalcommit 20a462e22c40915c8f12060df2456abf6338faecAuthor: shrimpcolo <shrimpcolo@gmail.com>Date: Mon Nov 16 17:02:35 2015 +0800 init todo project
github仓库创建
Create repository
不要勾选README 直接Create repository
加入github仓库
直接按照上图中的cmd 提示:
git remote add origin https://github.com/tancolo/IonicDemo.gitgit push -u origin master
在本地仓库目录cmd line中分别输入上述命令。
其中需要输入git用户名和密码。
成功完成!
0 0
- 本地代码导入github仓库
- 【github】上传本地代码仓库
- 导入本地代码到GitHub
- GitHub推送本地代码到仓库
- GitHub 上传本地代码到仓库
- 本地代码上传到Github仓库
- 本地更新代码同步至github仓库
- GitHub 上传本地代码到仓库
- GitHub上传本地代码到仓库[Windows]
- 本地代码上传到GitHub远程仓库
- github创建本地仓库
- github建立本地仓库
- GitHub新建本地仓库
- GITHUB本地创建仓库
- 将Xcode的本地代码push到github仓库上
- 【从小白到猿猴】上传本地代码到GitHub仓库
- 将Xcode的本地代码push到github仓库上
- 本地代码提交至gitHub远程仓库的方法
- spring mvc 配置 thymeleaf
- OS X上搭建distcc使用XCode进行分布式编译
- sqlite循环批量插入数据采用批处理文件实现
- 3-2 构造函数的调用
- spring mvc 集成 thymeleaf ----注解
- 本地代码导入github仓库
- 使用dom对html文档进行解析
- FastDFS 分布式的文件存储环境搭建
- 3-3 构造函数的调用(高级)
- xmpp整理笔记:xmppFramework框架的导入和介绍
- iOS-UIWebview与web端交互(javascript脚本)iOS公开接口供web端调用
- python
- 通过校内服务器实现免费上网
- 幼儿园学费比较