Get ready:
git software, GitHub account.
Git install:
Direct Baidu search git download, Windows and Mac different platforms. The official web is slow or not at all.
The default configuration is installed.
GitHub
Website: https://github.com
1. Apply for an account.
2. Add a repository to put your code in. There is a plus sign at the top right corner of the home page, click on the new repository, you can create a warehouse, if it is a new warehouse, not migrated, check initialize this repository with a README.
Using git:
The goal is to write code locally, manage local code with GIT, communicate with GitHub, and sync local code to GitHub.
First configure your own username, mailbox, is the local git configuration, can be different from GitHub information.
The next generation of your unique public and private key is to generate a pair of passwords, the public key you want to upload to GitHub, and every time you communicate with your github you need to verify your private key.
There's a unique matrix image behind it ...
Add SSH on GitHub, which is to upload the public key to GitHub.
To enter the Sshkey can be seen by the following command, copy and paste the table on the page above.
The next command is to see if the SSH pairing is successful, and then we can execute Git clone to clone the empty repository above the GitHub remote repository to local. The address at the back of clone is the address of your warehouse, which can be found in the lower right corner of the GitHub warehouse page.
Here we create a new CPP document, put it in the currently synced Lintcode folder, this time to view the Git status (Git status) found that the file has not been track, it can be through git Add. , git commit, git push three command synchronizes the local repository to the remote repository. After executing a git commit, use the VIM command to write the commit message: Press the I key first, enter the editing state, after writing the message, press ESC to exit the edit state, and then press: Wq to hold and exit.
When we're done, we'll open our own github and discover that our new CPP document has been synced to the remote repository.
git installation and basic usage