In the previous article, you explained how to use a remote repository, and then you use the common remote repository github to manage your project.
1) Create a warehouse on GitHub
To use GitHub, be sure to sign up for a GitHub account and then build a warehouse.
As for how to create a warehouse on GitHub, refer to: https://help.github.com/articles/create-a-repo/
I created a repository on GitHub: example.
2) Create and configure SSH
GitHub is a public warehouse management platform that is visible to everyone that you create. If you are updating a local repository file to a repository on GitHub, how does GitHub identify whether you submitted it or was submitted by someone else, which is the role of SSH configuration.
To generate an SSH key:
Ssh-keygen " [email protected] "
RSA is the algorithm name. Common algorithms are: RSA, DSA.
After executing the command, generate the public key, key file under the root directory. If it is a Linux system, it should be in the user's home directory. In the SSH directory, if it is on a Windows system, the same is true:
To configure SSH on GitHub:
After logging in to GitHub, in the Sshkeys configuration in the personal settings, add the configuration:
Copy the contents of the Public key file (the file ending in. pub) and paste it to the appropriate location in the browser.
3) incorporating remote repositories into the management
is actually adding a remote repository,
$ git remote Add example [email protected]:youruserid/example.git
or use:
$ git Remote Add example https://github.com/youruserid/example
4) Pull Remote files
If a file is already in the remote repository, pull the file to the local repository first. If there is no file remotely, this step is not required.
$ git Pull Example
5) Push the local file to the remote repository
$ git Push Example Master
When you first use Git's
clone
Or
push
command to connect to GitHub, you get a warning:
The authenticity of host ' github.com (xx.xx.xx.xx) ' can ' t be established.
RSA key fingerprint is xx.xx.xx.xx.xx.
Is you sure want to continue connecting (yes/no)?
This is because Git uses SSH connection, and SSH connection is the first time to verify the GitHub server key, you need to confirm that GitHub key fingerprint information is really from the GitHub server, enter
yes
You can enter.
Git will output a warning telling you that you have added GitHub key to a trust list on this machine:
' github.com ' (RSA) to the list of known hosts.
This warning will only appear once, and there will be no warning after the operation.
If the following error occurs:
SRC Refspec Master does not match any.
Indicates that there are files in the remote repository and requires 4) operation.
6) You can view the results using GitHub.
Put your project on GitHub.