V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
shinerene
V2EX  ›  程序员

用不来Git啊 求指导

  •  
  •   shinerene ·
    Xiechen · 2013-04-21 23:19:13 +08:00 · 4344 次点击
    这是一个创建于 4012 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如说 我在github上有一个叫做a的repo 然后我本地想要传一个叫做b的文件夹到a里面去 请问具体怎么操作呢
    我是mac os
    按照网上的教程 死活传不上去啊
    请教命令行下怎么来进行操作呢?

    谢谢了!!
    13 条回复    1970-01-01 08:00:00 +08:00
    znithy
        1
    znithy  
       2013-04-21 23:42:26 +08:00   ❤️ 1
    本地把b拷贝到a里
    git add b
    之后commit和pull
    fangpeishi
        2
    fangpeishi  
       2013-04-21 23:45:22 +08:00   ❤️ 1
    revlis7
        3
    revlis7  
       2013-04-22 00:26:27 +08:00   ❤️ 1
    git能对空文件夹操作嘛?我好像记得git操作都是针对文件的,如果要添加空文件夹,先要放一个空文件在里面,大概也许吧。

    教程看一遍:http://git-scm.com/book/zh/
    welsonla
        4
    welsonla  
       2013-04-22 09:18:57 +08:00   ❤️ 2
    b copy到a进去
    git add .
    git commit -m 'add b folder'
    git push
    sobigfish
        5
    sobigfish  
       2013-04-22 09:23:58 +08:00   ❤️ 1
    IIssNan
        6
    IIssNan  
       2013-04-22 09:43:05 +08:00   ❤️ 1
    总体来说三个步骤可以完成你的问题:
    一、克隆Github上的库到本地
    git clone [email protected]/yourname/a.git repoA
    上面的克隆操作使用SSH协议,需要设置过你的SSH Key,也可以考虑使用:
    git clone https://github.com/youname/a.git repoA


    二、本地进行修改,并提交
    正如@revlis7 所说,git不跟踪空文件夹。所以这里需要在你的b文件夹下建立一个占位文件,比如.gitkeep。
    git add .
    git status
    git commit -m "Added b"

    三、推送到Github上
    提交完成后推送到Github。假设你在master分支上,就执行:
    git push origin master就完成了。

    或许你可以把你遇到的问题说明一下,估计会有更针对性的解答:)
    shinerene
        7
    shinerene  
    OP
       2013-04-22 10:00:32 +08:00
    @znithy
    @welsonla
    @revlis7 嗯 发现了 一定要文件夹里面有文件 才可以
    shinerene
        8
    shinerene  
    OP
       2013-04-22 10:02:08 +08:00
    @fangpeishi 教程已经收藏了
    @sobigfish 这个try的教程很不错啊 相当不错!

    感谢啊~
    shinerene
        9
    shinerene  
    OP
       2013-04-22 10:03:11 +08:00
    @IIssNan 嗯 已经成功了!就是空文件夹的关系!
    shinerene
        10
    shinerene  
    OP
       2013-04-22 10:25:32 +08:00
    @IIssNan
    @znithy
    @fangpeishi
    @revlis7
    @welsonla
    @sobigfish 其实还有个问题 就是比如说 我在github上有一个repo(是一个项目的大的repo)就是直接跟在用户名/后面的那种 然后我想要在命令行中把它从github中给删除掉 请问要怎么操作呢?
    terry
        11
    terry  
       2013-04-22 13:25:30 +08:00
    dorentus
        12
    dorentus  
       2013-04-22 13:32:45 +08:00
    @shinerene 从 github 中删除 repo 只能登录到 github 网站上面去操作(这个操作其实已经和 git 无关了,纯粹是 github 的功能)
    shinerene
        13
    shinerene  
    OP
       2013-04-22 17:55:06 +08:00
    @dorentus 原来是这样~了解了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5536 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 06:43 · PVG 14:43 · LAX 23:43 · JFK 02:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.