git (Linux installation and tutorial)

View the current server has installed git

git --version

If so, check the version number, whether it is the latest version or you want

 

 

If it is not the version you want, then execute the following command to uninstall your current version

yum remove git

 

Download and install the new git after uninstalled, Centos / RedHat system available

yum install curl-devel expat-devel gettext-devel \
  openssl-devel zlib-devel

 

View the current system git

git

 

cd to wwwroot directory, create a directory, and you try to git remote repository, like, here it will be stored with your local files git

mkdir junyi

 

cd into the directory just created, initialized to the folder git repository

git init

 

The storage needs to be stored in the file to a local git

git add file name

 

 

Set the mailbox and username

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

 

Next submitted to the warehouse

git commit -m"first commit"

 

View the current file repository

git ls-files

 

Next to the time of the transfer to a remote repository

First of all, Mr. into their own key

ssh-keygen -t rsa -b 4096 -C "[email protected]"

 

Key generation can successfully see the path of the current generation

 

cd to this directory .ssh belong to a hidden directory, available ls -a first re-entering the browser

After entering the .ssh directory view the current key file, and copy down the contents of the file

more id_rsa.pub

 

Open gethub website and log in, click on the top right of picture, then click the Settings

 

Find SSH and GPG keys and click

 

 

Click the upper right corner of New SSH key to generate a new key

 

 

 Then complete the following steps and save

回到服务器远程连接git并把本地仓库的文件克隆上去

# git remote add origin [email protected]:自己的git组织名称/仓库名称.git
# git push -u origin master

 

本地先安装git,安装方法自行查找

 

本地获取远程仓库的文件,

 git clone git://github.com/组织名称/文件仓库名称.git

 

Guess you like

Origin www.cnblogs.com/junyi-bk/p/11083927.html
Recommended