比如说有一个文件路径是这样的:code/ridesharing_for_py27/然后里面是各种代码;code/ridesharing_for_py36/first_outbound_next_inbound/里面各种代码;code/ridesharing_for_py36/no_sequence/里面各种代码,你不想每一个代码开一个repository,然后想按照这样的路径存起来,方法如下(reference: https://stackoverflow.com/questions/8775850/how-do-i-add-files-and-folders-into-github-repos):

yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git rm --cached ./code
rm 'code'
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git add ./code
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git status
On branch master
Changes to be committed:(use "git reset HEAD <file>..." to unstage)deleted:    codenew file:   code/ridesharing_for_py27new file:   code/ridesharing_for_py36
......deleted:    ridesharing_for_py36/start time_212000_end time_213500.pngdeleted:    ridesharing_for_py36/start time_212500_end time_222000.pngdeleted:    ridesharing_for_py36/start time_214500_end time_220000.pngdeleted:    ridesharing_for_py36/start time_220500_end time_222000.pngdeleted:    scaling law of urban ride sharing.pdfdeleted:    shared-vehicle mobility-on-demand systems.pdfdeleted:    sid-talksimons.pdfUntracked files:(use "git add <file>..." to include in what will be committed)paper/yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git commit -m "your commit"
[master be5e9a6] your commit3 files changed, 2 insertions(+), 1 deletion(-)delete mode 160000 codecreate mode 160000 code/ridesharing_for_py27create mode 160000 code/ridesharing_for_py36
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git push -u origin master
Username for 'https://github.com': YanglanWang
Password for 'https://YanglanWang@github.com':
Counting objects: 564, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (564/564), done.
Writing objects: 100% (564/564), 33.07 MiB | 3.19 MiB/s, done.
Total 564 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), done.
To https://github.com/YanglanWang/ridehsharing.git67a9f60..942900d  master -> master
Branch master set up to track remote branch master from origin.
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ 

最终的结果是ridesharing里的所有文件都上去了,其实我不想让下载的那些论文也上去,so, 接着调整了一下:将这些论文打包放到paper文件里上传:

yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git add ./paper
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:(use "git reset HEAD <file>..." to unstage)new file:   paper/2014_tlc_factbook_data for addressing the minimum fleet problem in on-demand urban mobility.pdfnew file:   paper/addressing the minimum fleet problem in on-demand urban mobility.pdfnew file:   paper/efficient algorithms for finding maximum matching in graphs.pdfnew file:   paper/literature review.odtnew file:   paper/quantifying supplement.pdfnew file:   paper/quantifying the benefits of vehicle pooling with shareability networks.pdfnew file:   paper/scaling law of urban ride sharing.pdfnew file:   paper/shared-vehicle mobility-on-demand systems.pdfnew file:   paper/sid-talksimons.pdfChanges not staged for commit:(use "git add/rm <file>..." to update what will be committed)(use "git checkout -- <file>..." to discard changes in working directory)(commit or discard the untracked or modified content in submodules)deleted:    2014_tlc_factbook_data for addressing the minimum fleet problem in on-demand urban mobility.pdfdeleted:    addressing the minimum fleet problem in on-demand urban mobility.pdfmodified:   code/ridesharing_for_py27 (modified content, untracked content)modified:   code/ridesharing_for_py36 (modified content, untracked content)deleted:    efficient algorithms for finding maximum matching in graphs.pdfdeleted:    literature review.odtdeleted:    quantifying supplement.pdfdeleted:    quantifying the benefits of vehicle pooling with shareability networks.pdf
deleted:    ridesharing_for_py36/.idea/encodings.xmldeleted:    ridesharing_for_py36/.idea/misc.xmldeleted:    ridesharing_for_py36/.idea/modules.xmldeleted:    ridesharing_for_py36/.idea/ridesharing_for_py36.imldeleted:    ridesharing_for_py36/.idea/vcs.xmldeleted:    ridesharing_for_py36/.idea/workspace.xmldeleted:    ridesharing_for_py36/20150803_gaode_offboard.txtdeleted:    ridesharing_for_py36/20150803_gaode_onboard.txt
......deleted:    ridesharing_for_py36/start time_220500_end time_222000.pngdeleted:    scaling law of urban ride sharing.pdfdeleted:    shared-vehicle mobility-on-demand systems.pdfdeleted:    sid-talksimons.pdfUntracked files:(use "git add <file>..." to include in what will be committed)ridesharing_for_py36/without sequence/yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git commit -m "paper"
[master 915be5c] paper9 files changed, 0 insertions(+), 0 deletions(-)create mode 100644 paper/2014_tlc_factbook_data for addressing the minimum fleet problem in on-demand urban mobility.pdfcreate mode 100644 paper/addressing the minimum fleet problem in on-demand urban mobility.pdfcreate mode 100644 paper/efficient algorithms for finding maximum matching in graphs.pdfcreate mode 100644 paper/literature review.odtcreate mode 100644 paper/quantifying supplement.pdfcreate mode 100644 paper/quantifying the benefits of vehicle pooling with shareability networks.pdfcreate mode 100644 paper/scaling law of urban ride sharing.pdfcreate mode 100644 paper/shared-vehicle mobility-on-demand systems.pdfcreate mode 100644 paper/sid-talksimons.pdf
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ git push -u origin masterUsername for 'https://github.com': YanglanWang
Password for 'https://YanglanWang@github.com':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 797 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/YanglanWang/ridehsharing.git942900d..915be5c  master -> master
Branch master set up to track remote branch master from origin.
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ ^C
yanglan@yanglan-IdeaPad-U430p:~/Documents/ridesharing$ 

how to upload directory to github(怎么把文件目录上传到github)相关推荐

  1. PyCharm 社区版首次上传代码到GitHub和新增代码上传到GitHub(超详细)

    PyCharm 社区版首次上传代码到GitHub和新增代码上传到GitHub 文章目录 PyCharm 社区版首次上传代码到GitHub和新增代码上传到GitHub 1. 前言 2. 配置 git 3 ...

  2. 简单轻松的将本地项目上传到Github的两种简单方法

    如何将本地项目上传到Github 将本地项目上传到Github(两种简单.方便的方法) 一.第一种方法: 二.第二种方法: Git命令 查看.添加.提交.删除.找回,重置修改文件 查看文件diff 查 ...

  3. 如何把本地idea上的项目上传到github上以及出现invalid authentication data问题的解决措施

    注意看标题 是 上传到 github 上,所以你的 github 地址是 : github.com 而不是其他的,基于这个大方向下做以下修改: 第一步: 就需要正在github中创建一个账号:http ...

  4. 【GitHub】项目代码上传github

    本篇文章以macos为基础(windows系统同样有参考意义),介绍了git的卸载,homebrew的安装,git的安装以及利用git工具将项目代码放置github仓库. (1)git的卸载 本人电脑 ...

  5. Git的使用-将本地项目上传至Github/Github下载代码至本地-MAC

    一.使用的工具 安装Git iTerm 二.初始化操作 1.在github上创建新仓库 登录后,主页点击New repository 输入仓库名(description等可自行根据需求添加) 注意:仓 ...

  6. Android studio下将项目代码上传至github包括更新,同步,创建依赖

    AS中设置GIT 一.开篇 本文讲如何使用Android Studio将项目上传到github,虽然讲上传github的文章很多,但是大部分都是使用Git Bash命令行,虽然效率高些,但是有点麻烦, ...

  7. 【OpenGL】三、Visual Studio 2019 配置 GitHub ( 将项目上传到 GitHub )

    文章目录 一.将解决方案添加到源代码管理 二.首次将代码上传到 GitHub 三.GitHub 项目展示 一.将解决方案添加到源代码管理 在 " 解决方案资源管理器 " 中 , 右 ...

  8. 怎样将项目上传到github上

    怎样将项目上传到GitHub上面ni? 登录到你的GitHub账号 1.new repository 2.填写下面的信息–>create 3.这一步要用到三个git命令. $ git clone ...

  9. 使用git将本地项目上传到github

    这里给大家介绍一下,在GitHub上新建一个空项目,并把本地的项目代码上传到这个空项目中. 前期准备 1.GitHub账号,注册地址:https://github.com/ 2.本地安装git 在Gi ...

最新文章

  1. 深入JDK中的Optional
  2. 《因果科学周刊》第6期:领域自适应
  3. R语言画图功能到底有多厉害,看看就知道了
  4. 移动网站用backbone还是angular?
  5. git下载指定分支代码到本地
  6. 计算机硬件基础大纲,计算机硬件技术基础大纲_.doc
  7. xcode 编译时有相同的类,导致冲突,编译错误
  8. 安卓清理垃圾清理代码_用方面清理代码
  9. oracle的知识,oracle的基本知识
  10. 【今日CS 视觉论文速览】 9 Jan 2019
  11. Python高级编程(三)
  12. java cas原理_Java中的锁[原理、锁优化、CAS、AQS]
  13. 海尔手机V73 PC套件安装使用说明 管理好你的电话簿
  14. html设置默认选中状态,html select 标签设置默认选中
  15. 操作系统系列(三)——编译和链接
  16. C. Minimum Ties (构造)
  17. 使用gevent的Pool实现异步并发
  18. 三位数求解:已知xyz+yzz=n,其中n是一个正整数,x、y、z都是数字(0-9),编写一个程序求出x、y、z分别代表什么数字。若无解,则输出“No Answer” 注意:xyz和yzz表示一个三
  19. 在Unity中使用Excel表开发单选题和多选题
  20. 网络不稳定 网速忽高忽低,ping值忽高忽低的解决办法 无线网出现问题解决

热门文章

  1. 花了10分钟终于明白矩阵的逆怎么用了!
  2. 2019年3月WHQL认证最新申请流程
  3. 《蔡康永的201堂情商课(完结)》学习
  4. App Inventor 2能编译出苹果iOS版App吗?
  5. 引入静态路由_网络工程师提高篇 | 路由重发布你了解多少?从原理到配置,瑞哥带你学习一波!...
  6. Docker在自动化测试中的实践应用,看了必有提升
  7. 不降价的促销利器--让渡营销
  8. 添加打印机怎样锁定计算机名称,怎么安装打印机?_百度经验
  9. 医院信息系统 固定资产管理子系统
  10. 【江苏大学研究生小记】各方面都不太如意