1th step: Create SSH Key
In the. SSH directory under the user directory, see if there are two files for Id_rsa and id_rsa.pub, and if not, generate a key pair with the following command:
$ ssh-keygen -t rsa
2nd step: Login to GitHub, open "Account Settings", "SSH Keys" page:
Add content for Id_rsa.pub
3rd step, create a remote repository
On the GitHub Web page, follow the prompts to create a
4th step, connect the local and remote libraries
local library = Remote Library
In the local repository (if not, create first), run the command:
git remote add origin [email protected]:xxx/test xxx for your username, test for created remote warehouse name, origin for remote warehouse alias
git push-u Origin master pushes the contents of the local library to the remote, with git push
the command, actually pushing the current branch master
to the remote.
From now on, as long as the local commits, you can pass the command:
$ git push origin master
Push the master
latest changes from your local branch to GitHub, and now you have a truly distributed repository!
Remote Library = = Local library clone
Run in the appropriate local directory:
git clone [email protected]:xxx/test (SSH protocol, can also choose Other protocol HTTPS, etc.)
Git Learning-Remote repository