Ubuntu install git and git commands

1, check whether the git installed, enter the git version can be ordered, if there is no version number is displayed for not installed git

2, install git

sudo apt-get install git


3, configure the global environment git
git config --global user.name "username"
git config --global user.email "email address"


4, the key generating ssh
ssh-keygen -C 'you email [email protected] ' -t rsa
be in the user directory ~ / .ssh / establish the corresponding key files.


5. After you create a public key to be uploaded.
Use the command cd ~ / .ssh into the ~ / .ssh folder, enter the
cat id_rsa.pub
open id_rsa.pub file, copy all of its contents. Then visit git web page, click on the SSH public key, you can freely enter the title bar, public bar just to paste the copied content.

 

 Create an empty directory, initialize git repository, add a remote repository for testing


6, test the connection

命令:
ssh -T [email protected]
成功提示:
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Hi dingdingingitHub! You've successfully authenticated, but GitHub does not provide shell access.

 

7, git use the command

Project Address pull git clone project 
git pull pull the code 
git push into the repository 
git init command to initialize a git repository 
git add. Add files 
git the commit -m " comment " submitted to the warehouse. 
Origin HTTPS the Add Remote git: // . git.oschina.net/ your username / item name 
git, git push origin master to complete the push 
git checkout master switch to the master branch

 

Guess you like

Origin www.cnblogs.com/sunshinekevin/p/11617562.html