To use the git code documentation and other content management, we must first build Git environment, here are the steps:
1. Download git address is https://git-scm.com/download
Once you have downloaded directly mounted on it, is not required under mac active configuration environment variable, see if you can see through the successful download and install command in the terminal
git version
Be able to view the version number to prove been installed successfully
May report other error, you can own Baidu, also it depends xcode, so before installation to confirm whether the xcode is installed, if the error is also the first confirmation is no reason not to install the xcode
After successful installation, we need to view the Git configuration, the terminal execute the command as follows:
git config --list
We will also configure user information, the command is:
git config --global user.name "your user name"
git config --global user.email "email account"
git config core.ignorecase false (this is set whether local repository file case-sensitive, turned out to be true)
After configuration git environment has completed the installation configuration!
2, git github association-related operations in
The first local installation is no key, it needs to be generated key
Input terminal cd ~ / .ssh
Survival key command
ssh-keygen -t -rsa -C "To generate email account key"
After generating ls view the file contents if there is marked, if the key is generated on behalf of success, if not then proceed to generate the above command
There is no local matter suggest that you generate a key file, should get the computer to generate a bit, because the newly recruited staff or use another computer is likely to be before people use this computer generated before, you might not have permission to use
May set password generation process, it is best to set it safer! It may not be provided, the final displaying a rectangular box on the instructions to create a success
After generating the presence of local private key, the public needs to be uploaded to a remote warehouse! The first need to register a github account, the address is:
github.com
3, uploading the key
First of all: the key into the path of cd ~ / .ssh ls file and view the entire contents of id_rsa.pub copy cat inside
Second: Sign github, in the upper right corner is the center of personal avatar where clicks, there is a setting, click to enter
Finally, clone a remote repository, the command is:
git clone [email protected]:. ******* git behind the asterisk is the address on your own github
Appeals will go through the steps associated with better git and github
4, establishing a local warehouse
First, cd to the path where the project following their own, then use the command to create a virtual warehouse
git init
Secondly, you should upload the code to a remote repository need to put the code on the tool on the local repository
git add / local path to upload
Again, SVN and almost every change must commit to modify it, the specific command is:
git commit -m "quotes and storing the modified Remarks"
Finally, there is the local repository code uploaded to the remote repository github
git pull --rebase (before uploading the code first drop-down merge code, developers often use, test, then you can directly push)
git push (direct upload, you can also upload to the remote master branch)
git push origin Head:master
Postscript: git there are a lot of command, but then as a tester to remember a few common enough! If you want to see more commands or detailed information can be Baidu! The above information is very full!