Git is now a popular distributed version control system.
Centralized version control system repository is centrally stored in the central processing unit, so developers need to get the latest version from the central server, encoding and then send their own code to the CPU. The biggest drawback of a centralized version control system is that it must be networked to work.
Distributed version control system does not have the central processing unit, everyone's computer is a complete repository. Distributed version control systems often also require a computer that acts as a "central server," but this server is only used to facilitate the exchange of changes.
$git # Check if the system has git installed and the version number will be displayed
$sudo apt-get Install git #安装git
$mkdir Learngit #创建learngit目录
$CD Learngit #到learngit目录下
$pwd #查看当前目录
$git Init #把learngit目录变成git可以管理的仓库
$ssh-keygen-t rsa-c "emailaddr" #创建ssh key after landing on GitHub, open account settings, Add ssh key, paste id_rsa.pub in the key text box.
To access GitHub, click Create a new repo in the top right corner, creating a repository.
$git remote Add origin [email protected]:username/reponame
$git push-u Origin Master #将本地库推送到远程git仓库中
Since we first pushed the master branch and added the-u parameter, git will not only push the local master branch to the remote new Master branch, but also associate the local master branch with the remote Master branch.
$git clone [Email protected]:username/reponame #将远程库克隆到本地
GIT's Environment setup