I have already discussed about how to get started with git. After you know the basics, you might want to start your projects and may be finding a suitable git repository hosting for your project online. With very much confidence, I will suggest you to use github(I already mentioned about it on the previous article on reference section). This is currently the only one champion in git hosting. Others, which are exist, comparatively nothing. Here, I will show you including command line examples on how you can proceed with github.
Beginning with Github:
First, Register an get a account on github. You will come to know that, view here and understand that there are two kind of strategy to host your project there. One is free, you can host unlimited projects. But, those will be public, that means, anyone can get source code of those projects. This option is very good for open source projects and many renowned companies use github to host their official open source api projects. You could also consider Hostens for hosting services.
Create Repository And Verify Your Identity:
Although it is possible to create repository with command line argument, here won’t need this actually. Go with the easier way. On your ‘Dashboard’ tab on your github account, you will see an anchor link option with text ‘Create a Repository’, go with it. There you will have to enter the project name, and additionally you may enter description and homepage also(optional).
Now, you will have to verify your identity to github that you are the right owner of the account. For that, open your computer’s ‘Git Bash’ tool and use the following commands:
$ ssh-keygen -t rsa -C "firstname.lastname@example.org" Generating public/private rsa key pair. Enter file in which to save the key (/current-directory-path):Enter Path Here Enter passphrase (empty for no passphrase): Enter A Pass phrase Enter same passphrase again: Confirm your pass phrase
Remember carefully to enter the only github account email as it will identify your account using that email. Moreover, If you are on the the correct directory, you can skip entering path. Also, you can skip the pass phrase part also just by hitting enter.
After completing this steps successfully, a new file named ‘id_rsa.pub’ will be created in the directory. There you will get a key. Copy that, go to your github account’s ‘Account settings’ -> ‘SSH Public Keys’ -> Add a key, then paste the key. If you see any newline appended, you will may need to remove that, otherwise authentication may not work on later. To test, back to your ‘Git Bash’, use the following commands:$ ssh email@example.com The authenticity of host 'github.com (XXX.XXX.XXX.XXX)' can't be established. RSA key fingerprint is XX:XX:XX...... Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,XXX.XXX.XXX.XXX' (RSA) to the list of known hosts. ERROR: Hi yourname! You've successfully authenticated, but GitHub does not provide shell access Connection to github.com closed.
Starting Traditional Git Commands:
After completing the above primary stage, actually, we are all done for the github specific works. Now, we can start using our tradition way to execute git commands that i have discussed on my previous post, just you will need to remember all the times that you are using an remote server and will need to take the extra care(commands) that remote git server requires.
Here I have showed the simplest and quickest way to get things done for github, but github already has details step by step instruction. Go through them if you are having some special problems. If still you are having issues, please comment here to let me know, I will try to help out my best. Happy coding 😀