2015-04-05 49 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