Git Install & Config

本文详细介绍了Git的基本安装与配置步骤,包括用户信息设置、SSH密钥生成、.gitignore文件创建等内容,并提供了25个实用的Git操作技巧,帮助中级用户更高效地使用Git进行版本控制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.安装git

sudo apt-get update
sudo apt-get install git

2.配置git

必配置项:

git config --global user.name "YourName"
git config --global user.email "YourEmail@abc.com"

可选项:

git config --global https.proxy https://user:password@address:port 
git config --global color.ui true
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.br branch
git config --global alias.last 'log -1'
git config --global alias.unstage 'reset HEAD'
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

查看配置项:

git config --list
user.name=YourName 
user.email=YourEmail@abc.com

 

3.配置github ssh key

generating-an-ssh-key

 

4.配置gitignore

gitignore templates

 

5.git tips

25个Git用法技巧

25 Tips for Intermediate Git Users

 

6.git book

Git Book

 

 

 

# Dockerfile to build OpenSees, OpenSeesSP and OpenSeesMP # .. utilizes ubuntu:20.04 LTS as base # .. it will build all applications and place in /usr/local/bin # .. it will also install openmpi # .. to run OpenSeesSP and OpenSeesMP use mpiexec, e.g. mpiexec -n 2 OpenSeesSP example.tcl # written: fmk FROM ubuntu:20.04 SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;] WORKDIR /opensees RUN cp /etc/apt/sources.list /etc/apt/sources.list~ \ &amp;&amp; sed -Ei &#39;s/^# deb-src /deb-src /&#39; /etc/apt/sources.list \ &amp;&amp; apt-get update \ &amp;&amp; DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata git \ &amp;&amp; apt-get install -y sudo \ &amp;&amp; sudo apt-get install -y cmake gcc g++ gfortran liblapack-dev git python3-pip \ &amp;&amp; sudo apt-get install -y openmpi-bin openmpi-common libopenmpi-dev libscalapack-openmpi-dev \ &amp;&amp; pip3 install conan==1.60.1 \ &amp;&amp; git clone --depth 1 --branch hdf5-1_12_2 https://github.com/HDFGroup/hdf5.git \ &amp;&amp; cd hdf5 \ &amp;&amp; ./configure --prefix=/usr/local/hdf5 \ &amp;&amp; make \ &amp;&amp; cd .. \ &amp;&amp; git clone https://github.com/OpenSees/mumps.git \ &amp;&amp; cd mumps \ &amp;&amp; mkdir build \ &amp;&amp; cd build \ &amp;&amp; cmake .. -Darith=d \ &amp;&amp; cmake --build . \ &amp;&amp; cd ../.. \ &amp;&amp; git clone https://github.com/OpenSees/OpenSees.git \ &amp;&amp; cd OpenSees \ &amp;&amp; mkdir build \ &amp;&amp; cd build \ &amp;&amp; conan install .. --build missing \ &amp;&amp; cmake .. -DMUMPS_DIR=$PWD/../../mumps/build -DOPENMPI=TRUE -DSCALAPACK_LIBRARIES=&quot;/usr/lib/x86_64-linux-gnu/libscalapack-openmpi.so.2.1&quot; \ &amp;&amp; cmake --build . --config Release --target OpenSees \ &amp;&amp; cmake --build . --config Release --target OpenSeesSP \ &amp;&amp; cmake --build . --config Release --target OpenSeesMP \ &amp;&amp; cp ./bin/* /usr/local/bin \ &amp;&amp; cp -r ./lib/tcl8.6 /usr/local/lib \ &amp;&amp; cd ../.. \ &amp;&amp; rm -fr OpenSees \ &amp;&amp; rm -fr hdf5 \ &amp;&amp; rm -fr mumps # Dockerfile to build OpenSees, OpenSeesSP and OpenSeesMP # .. utilizes ubuntu:20.04 LTS as base # .. it will build all applications and place in /usr/local/bin # .. it will also install openmpi # .. to run OpenSeesSP and OpenSeesMP use mpiexec, e.g. mpiexec -n 2 OpenSeesSP example.tcl # written: fmk FROM ubuntu:20.04 SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;] WORKDIR /opensees RUN cp /etc/apt/sources.list /etc/apt/sources.list~ \ &amp;&amp; sed -Ei &#39;s/^# deb-src /deb-src /&#39; /etc/apt/sources.list \ &amp;&amp; apt-get update \ &amp;&amp; DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata git \ &amp;&amp; apt-get install -y sudo \ &amp;&amp; sudo apt-get install -y cmake gcc g++ gfortran liblapack-dev git python3-pip \ &amp;&amp; sudo apt-get install -y openmpi-bin openmpi-common libopenmpi-dev libscalapack-openmpi-dev \ &amp;&amp; pip3 install conan==1.60.1 \ &amp;&amp; git clone --depth 1 --branch hdf5-1_12_2 https://github.com/HDFGroup/hdf5.git \ &amp;&amp; cd hdf5 \ &amp;&amp; ./configure --prefix=/usr/local/hdf5 \ &amp;&amp; make \ &amp;&amp; cd .. \ &amp;&amp; git clone https://github.com/OpenSees/mumps.git \ &amp;&amp; cd mumps \ &amp;&amp; mkdir build \ &amp;&amp; cd build \ &amp;&amp; cmake .. -Darith=d \ &amp;&amp; cmake --build . \ &amp;&amp; cd ../.. \ &amp;&amp; git clone https://github.com/OpenSees/OpenSees.git \ &amp;&amp; cd OpenSees \ &amp;&amp; mkdir build \ &amp;&amp; cd build \ &amp;&amp; conan install .. --build missing \ &amp;&amp; cmake .. -DMUMPS_DIR=$PWD/../../mumps/build -DOPENMPI=TRUE -DSCALAPACK_LIBRARIES=&quot;/usr/lib/x86_64-linux-gnu/libscalapack-openmpi.so.2.1&quot; \ &amp;&amp; cmake --build . --config Release --target OpenSees \ &amp;&amp; cmake --build . --config Release --target OpenSeesSP \ &amp;&amp; cmake --build . --config Release --target OpenSeesMP \ &amp;&amp; cp ./bin/* /usr/local/bin \ &amp;&amp; cp -r ./lib/tcl8.6 /usr/local/lib \ &amp;&amp; cd ../.. \ &amp;&amp; rm -fr OpenSees \ &amp;&amp; rm -fr hdf5 \ &amp;&amp; rm -fr mumps
最新发布
03-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值