Linux installs Git and configures it to pull project code and commit

content

1. Install GIT

yum   install  git

insert image description hereinsert image description here

2. Configure username and email

git config --global user.name'xxxxx'
git config --global user.email'[email protected]'

3. Initialization

Perform the git initialization operation in the local warehouse, switch the local warehouse, that is, the storage location of the pulled code.
After selecting the directory, execute the command. After execution, a .git folder will be generated in the directory.

git  init

4. Set the warehouse address

git   remote   add  origin  github地址
例如:
git   remote   add  origin https://gitlab.com/xxx/xx.git

5. Pull the code

git  pull  origin 分支名称
例如:
git  pull  origin mydemo1.0

insert image description here

6. Set the time to save the account password

If this step is not set, it is very troublesome to enter the account number and password every time you pull the code.

Save it permanently, pull the code again and enter the account password and it will be permanently saved, and then you don't need to enter the account password when you pull the code again.

git config --global credential.helper store

Temporarily save the default cached password for 15 minutes

git config --global credential.helper cache

save an hour

git config --global credential.helper 'cache --timeout=3600'

7. View the modified code

git  status

8. Submit

Do the following in sequence:

git  add  .       #    .代表的是所有文件,当然也可以指定文件
git commit  -m  ‘提交说明’  .
git  push   origin  ‘分支名’

Guess you like

Origin blog.csdn.net/m0_54850467/article/details/123652565