About the use of git

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/mynewdays/article/details/101673442

About shell

Recommended to install oh-my-zsh in linux, so you can more easily use git commands

centos default shell is bash, you can use the following command to see what shell is currently installed on the system

cat /etc/shells

Then use the following command to view the current use of the default shell

echo $SHELL

You can install as follows the new shell, on-my-zsh, compared to the bash, with more body, more beautiful interface and more features

First install zsh, because based on-my-zsh zsh

yum install zsh

Then install the oh-my-zsh

There are so several installation methods

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

or

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Installation or use git, git to be installed on your computer before you can use

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

After installation, and you can switch between the shell

Switching to zsh

chsh -s /bin/zsh

Switching to the default bash

chsh -s /bin/bash

You can also update oh_ny_zsh

upgrade_oh_my_zsh

Or delete

uninstall_oh_my_zsh

User name and mailbox

git submission requires user identity, you can set up a user name and mailbox

First, you can use the following command to check whether the current settings are user name and email

git config user.name
git config user.email

If the result is empty, you can use the following command to create a user name and mailbox

git config user.name 'xxx'
git config user.email '[email protected]'

Pulling and presenting data

When cloning a remote repository from the warehouse, there are two ways, namely http and ssh

http way

Cloning of the following commands warehouse

git clone 版本库地址 [本地文件夹名称]

Behind the local folder name, if not provided, we will use the name of the remote repository

Pull process, the need to provide remote repository user name and password, if your code on a remote repository in the cloud, the user name and password is your account number and password codes cloud

ssh way

The provinces this way, every time a user name and password of trouble, but you need to create ssh-key on your computer

 

View ssh-key

If you want to be able to submit data to a remote repository, you need to use the private key

Keys are created, you can view the currently created

cat ~/.ssh/id_rsa.pub

Creating ssh-key

The following command creates a ssh-key

ssh-keygen

.ssh file will be created under the current user (root) directory

If the windows system, generally will be created in the current user directory when creating asks the

For example, I created the following directories

C:\Users\csdny\.ssh

Add ssh-key

Code to cloud, for example, find the need to operate the repository , find the "add the keys" in the "Management"

Note: If only for pulling data, add "deploy a public key" to

Use the following command to view the public

cat ~/.ssh/id_rsa.pub

Then copy the contents, added to the public key

If you need to submit data, you need to add "personal public key" approach is to delete the original Office public key, and then add content to individual public key in the public key

 

 

Guess you like

Origin blog.csdn.net/mynewdays/article/details/101673442