Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to get/clone a fetch/pull/read -only copy of a git repository?

Here's a git repository on github:

git://github.com/Fudge/gltail.git

What's the simplest way to check out a read-only copy using the git command line tool?

update: Here's a suggestion to the githubbers: Do something similar to google code, which automatically displays a message such as:

Use this command to anonymously check out the latest project source code:
    # Non-members may check out a read-only working copy anonymously over HTTP.
    svn checkout http://orapig.googlecode.com/svn/trunk/ orapig-read-only

update: The githubbers have done this.

like image 678
Mark Harrison Avatar asked Feb 10 '10 02:02

Mark Harrison


People also ask

Which command get a copy of an existing git repository?

The git clone command copies an existing Git repository.

How do I fetch and pull in git?

Git Fetch is the command that tells the local repository that there are changes available in the remote repository without bringing the changes into the local repository. Git Pull on the other hand brings the copy of the remote directory changes into the local repository.


3 Answers

git clone git://github.com/Fudge/gltail.git
like image 160
mipadi Avatar answered Oct 20 '22 11:10

mipadi


The question is a bit misleading. There's not really such a thing as a "read-only copy" of a git repository. You can clone an existing repository with:

git clone git://example.com/path/to/repo.git

But unlike Subversion, every "copy" in git is itself a completely new repository. Since you can commit to your own repository, it's certainly not read-only in that sense.

like image 23
John Feminella Avatar answered Oct 20 '22 11:10

John Feminella


I didn't found a real "read-only copy", but you can approach it by this way depending on your need :

1) git clone --depth 1 git://github.com/Fudge/gltail.git
Explanation : as you ask for a copy, you may not be interested by the full history of that copy.
--depth 1 option limits the download to the last version of the default branch and may reduce dramatically the amount of data to retrieve.

2) If you don't want to update your copy, you can remove the .git directory at the root of your copy : it will cut the link with the original repository.

Otherwise, if your need is to be sure that you never modify the original repo, it must be managed by your access rights on this original repo.

like image 9
herve-guerin Avatar answered Oct 20 '22 12:10

herve-guerin