Git is a fast and Scalable Distributed version control system. It has a rich set of commands and provides advanced operations and full access to internal systems.
1. Install Git:
1. Binary installation:
$ Sudo apt-get install git-core
After the installation is complete, enter git in the terminal to view the relevant commands. If you only need to use git to manage local code, you can use it now. If you need to work with a github project, you need to do other operations.
2. github account application
If you only need to copy the code you are interested in on github to your local computer and use it for modification without sharing the release, it does not matter if you do not apply for an account, you only need to clone the code locally by using git. $ Git clone git: // IP work (working directory name ).
After all, github is used for Open Source purposes. First, register an account on github.com.
3. Create a local folder and initialize some global variables.
$ Git config -- global user. name = "user name or user ID"
$ Git config -- global user. email = email
These two options will be automatically added to the Code during future use.
4. Create a public key for verification
This is a complicated and confusing issue for most people. Because git accesses the resource library through ssh, it is necessary to create a file for authentication locally. Use the command: $ ssh-keygen-C 'you email address@gmail.com '-t rsa will be in the user directory ~ /. Ssh/to create the corresponding key file. You can use the $ ssh-v git@github.com command to test whether the link is unblocked.
5. Upload the Public Key
On the github.com page, select Account Settings in the upper-right corner, select SSH Public Keys, and select Add.
Title can be named at will. The Key content is copied from ~ /. Ssh/id_rsa.pub content, after completion, you can use the ssh-v git@github.com for testing. The following information indicates that the verification is successful.
Ii. Configure and use Git
You can use github to manage your projects by following the steps below.
1. Create a warehouse
Use git init to create a repository in the folder where you want to create a project. After that, you can see an additional. git hidden directory in the file home.
2. Add a file
Use git add. To add an initial file. In this example, all the files in the folder are added. You can also specify the file to be added.
3. Submit a file
Use git commit-m'comment' to submit the edited content.
4. delete or add remote github sources
Git remote add origin https://github.com/Git-Elite/CodeBase.git // The repository address hosted by github in the Blue Section
5. submit it to the github repository.
Git push-u origin master