2015-04-05 59 views
0

当我创建一个新的回购,然后克隆它,并尝试添加一个文件,然后我的系统说没有回购。为什么?为什么将新文件添加到新回购很困难?

$ git clone https://github.com/montao/oslab.git 
Cloning into 'oslab'... 
Username for 'https://github.com': montao 
Password for 'https://[email protected]': 
remote: Counting objects: 4, done. 
remote: Compressing objects: 100% (3/3), done. 
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 
Unpacking objects: 100% (4/4), done. 
Checking connectivity... done. 
[email protected]:~/Desktop/kth/os/smallshell$ ls 
a.out  cpipe.c.orig digenv.c.orig omdirigering.c.orig pipe.c.orig types.c~ 
backup.c digenv  digenv.dat  oslab    RunSafe  types.c.orig 
cpipe.c digenv.c  omdirigering.c pipe.c    RunSafe.c 
cpipe.c~ digenv.c~  omdirigering.c~ pipe.c~    types.c 
[email protected]:~/Desktop/kth/os/smallshell$ git add digenv.c 
fatal: Not a git repository (or any of the parent directories): .git 
[email protected]:~/Desktop/kth/os/smallshell$ 
+4

你确定你在正确的子目录吗?克隆后,你的git仓库应该有一个子目录“oslab”。 – 2015-04-05 20:47:46

+0

@DirkTrilsbeek好吧有一个。我没有看到它。 – 2015-04-05 20:48:50

回答

3

您克隆您的回购协议的oslab文件夹,并尝试添加您的文件在不同的文件夹在你的情况~/Desktop/kth/os/smallshell看起来不太正确。转到正确的文件夹,然后你可以添加和提交你的文件。

0

git说明的原因是,您不在存储库中,因为您需要cd到包含存储库的目录中。例如:

git clone https://github.com/montao/oslab.git 
cd oslab 
git add digest.c