One common problem with big git repos is it takes a lot of time to clone, because in cloning git download everything beginning form the first commit. Sometimes we don’t need that much of history with code.
We can use “–depth” option in “git clone” command to specify how many commits we need. By providing an argument of “–depth 1” to the clone command, the process will copy only the latest revision of everything in the repository.
For example –
git clone --depth 1 https://github.com/jquery/jquery.git jquery
This command only clones the HEAD of the jqueyr repository.
Note: Prior to git 1.9 we can’t use do pull or push on such repos.
If you are using multiple github account for work and home projects or you are using one github account and one bitbucket account or any other git hosting service out there with SSH you have to manage SSH keys using a config file.
Lets go through each step for setting up github and bitbucket account-
Step 1: ssh keys
Create any keypairs you’ll need. In this example I’ve named these key pairs as ‘id_rsa_github’ and ‘id_rsa_’bitbucket:
ssh-keygen -t rsa -C “firstname.lastname@example.org"
ssh-keygen -t rsa -C “email@example.com”
Step 2: ssh config
Set up multiple ssh profiles by creating/modifying ~/.ssh/config. Note the differing ‘Host’ values:
# For GitHub
# For BitBucket
Step 3: ssh-add
You may or may not have to do this. To check, list identity fingerprints by running:
$ ssh-add -l
2048 1f:1a:b8:69:cd:e3:ee:68:e1:c4:da:d8:96:7c:d0:6f firstname.lastname@example.org (RSA)
2048 6d:65:b9:3b:ff:9c:5a:54:1c:2f:6a:f7:44:03:84:3f email@example.com (RSA)
If your entries aren’t there then run:
Step 4: test
To test you’ve done this all correctly, I suggest the following quick check:
$ ssh -T firstname.lastname@example.org
Hi Saurabh! You’ve successfully authenticated, but GitHub does not provide shell access.
I hope this will save someone’s hair!!