【问题标题】:I have a folder in a Github Repository. How do I "push" files into that folder?我在 Github 存储库中有一个文件夹。如何将文件“推送”到该文件夹​​中?
【发布时间】:2016-02-15 18:25:00
【问题描述】:

我在 github 中有一个远程存储库。我采取的步骤是:

  1. git init //initializes git in current directory
  2. git add * //adds every folder in directory to staging area
  3. git commit -m "message here" //commits all files in staged area with message
  4. git remote add origin remoteURL //add remote repository from github

现在,最后一步:

  1. git push origin master:master //this simply adds the file to the main page of my github repository.

如何将这些文件推送到 Github 存储库的现有文件夹中?我的 Github 存储库中有一个包含自述文件的文件夹“Requirements”。我需要把我的文件推到里面。

如果问题令人困惑,我很抱歉。我试图找到解决方案,但无法解决。

【问题讨论】:

    标签: git github repository


    【解决方案1】:

    尝试使用git pull。然后你应该在本地机器上看到Requirements 文件夹,你可以把你想要的文件放进去。

    【讨论】:

      【解决方案2】:

      如果您还没有 github 存储库的本地副本,请将其克隆到您的本地 PC,如下所示:

      git clone [link to repo here]
      

      然后在您的本地区域添加文件夹和文件。

      右键单击您的本地文件,您将有 Git 选项。一个可能是提交选项。

      然后推送回 GitHub。

      您可能会发现使用 GitHub Desktop 更容易:https://guides.github.com/introduction/getting-your-project-on-github/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-11-29
        • 2016-05-12
        • 2021-05-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-16
        • 2012-02-05
        相关资源
        最近更新 更多