Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
回购中的git回购_Git_Github - Fatal编程技术网

回购中的git回购

回购中的git回购,git,github,Git,Github,我不小心在回购协议中出错,我将文件夹中的一个文件夹分别推入另一个回购协议。我想要的是将folder1推回到main文件夹repo,但是当我尝试推送它时,我无法访问github用户界面上的内容。我已经删除了意外推出的回购协议。我的回购协议是这样组织的: -mainfolder -folder1 <- I accidently pushed folder1 into another repo -folder2 -folder3 -folder4 -README.

我不小心在回购协议中出错,我将文件夹中的一个文件夹分别推入另一个回购协议。我想要的是将
folder1
推回到
main文件夹
repo,但是当我尝试推送它时,我无法访问github用户界面上的内容。我已经删除了意外推出的回购协议。我的回购协议是这样组织的:

-mainfolder
   -folder1  <- I accidently pushed folder1 into another repo
   -folder2
   -folder3
   -folder4
   -README.md
-main文件夹

-folder1按照Git的消息所说的去做!它告诉你:

hint: If you added this path by mistake, you can remove it from the      
hint: index with:
hint: 
hint:   git rm --cached folder1
那就这么做吧。总而言之:

rm -rf folder1/.git
git rm --cached folder1
git add folder1

现在提交并推送。

嘿,srty!您可以删除
folder1
中的
.git
文件夹,删除folder1中的
.git
文件后,我仍然无法访问folder1中的内容,在github ui上,它显示了一个文件夹,里面有一个箭头。我只需
git rm--cached folder1
并重新添加该文件夹即可
rm -rf folder1/.git
git rm --cached folder1
git add folder1