GitHub my 163 e-mail registered
1th step: Create SSH Key. In the user's home directory, see if there is a. SSH directory, if there is, then look at this directory there are no id_rsa
and id_rsa.pub
these two files,
If you already have one, you can jump right to the next step. If not, open the shell (open git Bash under Windows) and create SSH Key:
$ ssh-keygen -t rsa -C "[email protected]"
You'll need to change your email address to your own email address (git email address), then go all the way to the default value, because this key is not for military purposes, so you don't need to set a password.
If all goes well, you can find the directory in the user's home directory .ssh
, there are id_rsa
and id_rsa.pub
two files, these two are SSH key key pair, id_rsa
is the private key, can not be leaked out,
id_rsa.pub
is a public key that can be safely told to anyone.
2nd step: Login to GitHub, open "Account Settings", "SSH Keys" page: Add public key
GitHub allows you to add multiple keys. Suppose you have a number of computers that you submit at the company for a while and submit at home, as long as you add the key for each computer to GitHub,
You can push it to GitHub on every computer.
To add a remote library
Once you have created a git repository locally, you want to create a git repository on GitHub and synchronize the two warehouses remotely, so that the repository on GitHub can be used as a backup, and that other people can collaborate through the warehouse.
First, log on to GitHub, and then, in the upper right corner, find the "Create a new Repo" button to create a new repository: Learngit; successful creation
At the moment, this warehouse on GitHub learngit
is still empty, and GitHub tells us that we can clone a new warehouse from this warehouse, or associate an existing local repository with it.
Then, push the contents of the local repository to the GitHub repository.
1. Follow GitHub's prompts to run the command in the local learngit
repository:git remote add Origin [email protected]:jacobwan/learngit.git
After adding, the name of the remote library is origin
, this is the default term for git, it can be changed to another, but origin
this name is known as a remote library
2. Next, you can push all the contents of the local library to the remote library: git push
Git push-u Origin Master
Pushing the contents of the local library to the remote, with git push
the command, is actually pushing the current branch master
to the remote.
Since the remote library is empty, the first time we push master
a branch, with -u
parameters, Git will not only master
push the local branch content of the remote new master
branch, but also the local master
branch and the Remote master
Branch Association, You can simplify the command at a later push or pull.
3. From now on, as long as local submissions are made, they can be ordered:git push origin master
Cloning from a remote library
Log on to GitHub and create a new repository named Ali
We tick Initialize this repository with a README
, so GitHub will automatically create a file for us README.md
. Once created, you can see the README.md
file
Created successfully
In the workspace, enter:
git clone [Email Protected]:jacobwan/ali.git
To clone a warehouse, you must first know the address of the warehouse and then use the git clone
command clone.
2016/01/13 start learning git: remote repository