初次推送到GitHub Missing Sub Directory [英] Initial push to GitHub Missing Sub Directory

查看:97
本文介绍了初次推送到GitHub Missing Sub Directory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从代码库对GitHub进行了初步推送,但两个网站子目录之一因某种原因未被推送。

我们在两个子目录中都有 .git 文件,但在创建这个新的组合存储库之前删除了它们。



我们已经尝试在子目录中添加一个文件,但SourceTree没有看到变化。



你将如何添加这些子文件夹? 我们在.git文件中都有.git文件目录,但在创建这个新的组合存储库之前删除它们。


这还不够:您需要删除(未找到) gitlink (两个子目录的文件夹名称,以特殊)

  git rm --cached子文件夹1 
git rm - -cached subfolder2

git commit -mremove gitlinks

然后你可以添加和提交(提供嵌套的.git /文件夹确实没有了)。

  git add。 
git commit -m添加两个子文件夹
git push


I made an initial push to GitHub from our codebase but one of the two websites sub directory didn't get pushed for some reason.

We had .git files in both sub directories but removed them prior to making this new combined repository.

We've tried adding a single file to the sub directory but SourceTree isn't seeing picking up the changes.

How would you add those subfolders?

解决方案

We had .git files in both sub directories but removed them prior to making this new combined repository.

It is not enough: you need to remove (untrack) the gitlink (folder name of the two subdirectories, viewed as a special entry in the index of the parent repo)

 git rm --cached subfolder1
 git rm --cached subfolder2

 git commit -m "remove gitlinks"

Then you can add and commit (provided the nested .git/ folders are indeed gone)

git add .
git commit -m "add two subfolders"
git push 

这篇关于初次推送到GitHub Missing Sub Directory的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆