Skip to content

Cloning Git Repositories

1.Physical filesystem full representative copy of the original repository.

  • NOTICE: It’s just a copy of your repository & it’s not linked to your original repository!
				
					# cp -rf gittest gittest2
# cd gittest2
# git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore
nothing added to commit but untracked files present (use "git add" to track)

				
			

2.Retrieve an entire copy of repository from a local repository.

  • NOTICE: It’s a copy of your repository which it is linked to the original repository!
				
					# git clone /home/ubuntu/gittest gittest2
# cd gittest2
# vi testfile.txt : “New File Added”
# git status; git add testfile.txt
# git commit -m “New File Added”
# cd ../gittest
# git pull /home/ubuntu/gittest2

				
			

3.Retrieve an entire copy of repository from a remote repository.

				
					# ssh-keygen
# ssh-copy-id arash@192.168.1.2
# git clone arash@192.168.1.2:/home/arash/gittest gittest_local
# cd gittest_local; vi new_file : “new file added”
# git add new_file
# git commit -m “New File Added”
$ git pull root@192.168.1.3:/home/arash/gittest_local
* branch            HEAD       -> FETCH_HEAD
Fast-forward
new_file | 1 +
1 file changed, 1 insertion(+)
create mode 100644 new_file

				
			

Leave a Reply

Your email address will not be published. Required fields are marked *