Git Ubuntu the installation, initial configuration and submitting

1. Install git

 Open the terminal, enter the command sudo apt-get install gitto install

sudo apt-get install git

Here Insert Picture Description
 Enter gitcheck whether the installation was successfulHere Insert Picture Description

2. Configure a public key

 Git configuration after installation for
 sequentially input instruction

git config --global user.name "你的名字"
git config --global user.email "你的邮箱地址"

Here Insert Picture Description
 After configuration, you need to create a public key used to verify, because the git repository is accessed by way of ssh, we need to create a file verification locally. Use the command ssh-keygen -C 'you email [email protected]' -t rsa(no space between ssh and -keygen), will be in the user directory ~/.ssh/to establish the appropriate key file.

ssh-keygen -C '你的邮箱地址'  -t  rsa

Process needs to press the Enter key three times
Here Insert Picture Description

3. Create a public viewing

cd ~/.ssh
gedit id_rsa.pub

Here Insert Picture Description

4. git repository submit

git init     #初始化一个git仓库
git add <file>   #添加文件
git commit -m  <message>   #提交至仓库。
git remote add origin https://git.oschina.net/你的用户名/项目名.git
git push origin master

git commitCommand, -mentered followed by explanation of this submission, you can enter any of the content, of course, the best is meaningful, so you can from the history list easy to find change records.
 Why add files Git needs add, commita total of two steps it? Because commitit can submit many files at once, so you can multiple adddifferent files, such as:

git add file1.txt
git add file2.txt file3.txt
git commit -m "add 3 files."

Reference Bowen

Published 43 original articles · won praise 80 · views 8722

Guess you like

Origin blog.csdn.net/qq_44717317/article/details/103952344