Original address: http://blog.csdn.net/hustpzb/article/details/8230454
Git is a distributed Code management tool, remote code management is SSH-based, so to use the remote git requires SSH configuration.
The SSH configuration for GitHub is as follows:
One
Set the user name and email for git:
$ git config--global user.name "Xuhaiyan"
$ git config--global user.email "[Email protected]"
Second, the process of generating SSH key:
1. See if you already have an SSH key: CD ~/.ssh
If there is no key then there will be no such folder, there is a backup to delete
2. Survival key:
$ ssh-keygen-t rsa-c "[email protected]"
Press 3 to enter, the password is empty.
Your identification has been saved In/home/tekkub/.ssh/id_rsa.
Your public key has been saved in/home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
..................
Finally, two files were obtained: Id_rsa and Id_rsa.pub
3. Add the encryption key to the Ssh:ssh-add file name
Enter the password before you need it.
4. Add the SSH key on GitHub, which adds the public key in "Id_rsa.pub".
Open https://github.com/, log in to your account, and then add SSH. (Git.oschina as well)
5. Test: SSH [email protected]
The authenticity of host ' github.com (207.97.227.239) ' can ' t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Is you sure want to continue connecting (yes/no)? Yes
Warning:permanently added ' github.com,207.97.227.239′ (RSA) to the list of known hosts.
Error:hi tekkub! You ' ve successfully authenticated, and GitHub does not provide shell access
Connection to github.com closed.
Third, start using GitHub
1. Get the source code:
$ git clone [email protected]:billyanyteen/github-services.git
2. So there's a repo on your machine.
3.git different from SVN is that git is distributed and there is no server concept. All the people have a repo on the machine, each submission is to their own machine repo
Warehouse initialization:
Git init
Generate a snapshot and deposit the project index:
git add
Files, git rm,git mv, etc...
Project Index submission:
Git commit
4. Collaborative programming:
Merge the local repo with repo from the remote origin,
Push local update to remote:
Git push Origin Master
Update remote updates to Local:
Git pull Origin Master
Add:
To add a remote repo:
$ git remote add upstream git://github.com/pjhyett/github-services.git
To rename a remote repo:
$ git://github.com/pjhyett/github-services.git to "upstream"
git ssh key generation steps