问题
Possible Duplicate:
Partial clone with Git and Mercurial
I switched into the specific directory into which I'd like my repo file to be copied into, and then tried the following:
git clone git@github.com:path/to/file.java
but it's giving me ERROR: repository not found
Can anyone tell me what's going on, and what's the right thing to do? (a little background doesn't hurt!)
回答1:
You may want to look into something called a sparse checkout which was implemented in Git 1.7 I believe. Before that I don't think git allowed you to do so although on github you can always copy individual files from their web interface by opening the file and saving it.
回答2:
git works at the repository level, not at the file level (unlike CVS/SVN).
As a result, if you clone you usually clone the whole repo - and a change is tracked as a repository content change - not a simple file change.
来源:https://stackoverflow.com/questions/10004508/how-do-you-use-git-to-retrieve-just-one-or-a-few-files-from-a-repo