Wednesday, June 2, 2021

Command 'git clone'



Cloning a repository with only the URL

(base) ~\ws>git clone https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... Logon failed, use ctrl+c to cancel basic credential prompt. Username for 'https://github.com': ashishjain1547@gmail.com Password for 'https://ashishjain1547@gmail.com@github.com': remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (9/9), done. remote: Total 16 (delta 5), reused 10 (delta 3), pack-reused 0 Unpacking objects: 100% (16/16), 5.70 KiB | 12.00 KiB/s, done. (base) ~\ws>tree /f Folder PATH listing for volume Windows Volume serial number is 8139-90C0 C:. └───repo_for_testing .gitignore LICENSE newFile.txt README.md test_file_20210528.txt (base) ~\ws>cd repo_for_testing (base) ~\ws\repo_for_testing>git branch * main (base) ~\ws\repo_for_testing>git branch -a * main remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch (base) ~\ws\repo_for_testing>git branch -r origin/HEAD -> origin/main origin/main origin/test_branch (base) ~\ws\repo_for_testing>git branch -D fatal: branch name required

Cloning a repository with URL and branch name.

(base) ~\ws_diff_branch>git clone --branch test_branch https://github.com/ashishjain1547/repo_for_testing.git Cloning into 'repo_for_testing'... remote: Enumerating objects: 16, done. remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 100% (9/9), done. remote: Total 16 (delta 5), reused 10 (delta 3), pack-reused 0 Unpacking objects: 100% (16/16), 5.70 KiB | 8.00 KiB/s, done. (base) ~\ws_diff_branch>cd repo_for_testing (base) ~\ws_diff_branch\repo_for_testing>git branch * test_branch (base) ~\ws_diff_branch\repo_for_testing>git branch -a * test_branch remotes/origin/HEAD -> origin/main remotes/origin/main remotes/origin/test_branch (base) ~\ws_diff_branch\repo_for_testing>git branch -r origin/HEAD -> origin/main origin/main origin/test_branch

Notes From Bitbucket

#1 Cloning to a specific folder git clone <repo> <directory> Clone the repository located at <repo> into the folder called ~<directory>! on the local machine. #2 Cloning a specific tag git clone --branch <tag> <repo> Clone the repository located at <repo> and only clone the ref for <tag>. #3 Shallow clone git clone -depth=1 <repo> Clone the repository located at <repo> and only clone the history of commits specified by the option depth=1. In this example a clone of <repo> is made and only the most recent commit is included in the new cloned Repo. Shallow cloning is most useful when working with repos that have an extensive commit history. An extensive commit history may cause scaling problems such as disk space usage limits and long wait times when cloning. A Shallow clone can help alleviate these scaling issues. Ref: Bitbucket [20210602] Tags: Technology,GitHub,Cloud,Windows CMD,

No comments:

Post a Comment