"git add"返回“致命的:外部存储库";错误 [英] "git add" returning "fatal: outside repository" error

查看:87
本文介绍了"git add"返回“致命的:外部存储库";错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正进入git的美好世界. 我必须提交对程序进行的一堆更改,这些更改位于名为/var/www/myapp的目录中.

I'm just entering into the wonderful world of git. I have to submit a bunch of changes that I've made on my program, located in a directory called /var/www/myapp.

我创建了一个新目录/home/mylogin/gitclone.从这个目录,我对公共仓库做了一个git clone,我能够得到最新的副本.

I created a new directory /home/mylogin/gitclone. From this directory, I did a git clone against the public repo and I was able to get the latest copy created.

我现在正试图弄清楚如何将我的工作文件夹(/var/www/myapp)中的所有文件取出并检入"到主存储库中.

I'm now trying to figure out how to take all the files in my working folder (/var/www/myapp) and "check them in" to the master repository.

/home/mylogin/gitclone中,我尝试了git add /var/www/myapp,但是却收到一个错误,我尝试添加的文件夹不在存储库之外.

From /home/mylogin/gitclone, I tried git add /var/www/myapp but I'm getting an error that the folder I tried to add is outside the repository.

您能给我一些有关我做错事情的提示吗?另外,我想添加所有内容,无论它是否与母版不同. 谢谢.

Can you give me a few pointers on what I'm doing wrong? Also, I'd like to add everything, whether it's different from the master or not. Thanks.

推荐答案

首先在克隆文件夹中可以创建一个Branch(这样,母版将保持不变)

First in the clone folder you can create a Branch (so the master stay untouched)

git branch [branch_name]

只需将所需文件从旧文件夹复制到克隆文件夹即可.

After just copy the files you want from your old folder to the clone folder.

完成后,只需添加/提交更改,然后

When you are done, just add / commit your change and Merge your branch into the "master" branch. It will look to something like this:

git add .
git commit -m "Comments"
git checkout master
git merge [new_branch]

尝试来自GitHub的教程.

这篇关于"git add"返回“致命的:外部存储库";错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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