1.下载GIT地址:
https://gitforwindows.org/
博客:https://blog.csdn.net/Mr_blueD/article/details/79658029
一路Next即可:
2.在Git Bash界面生成ssh key
$ssh-keygen
出现打印说明ssh key已经生成
3.获取ssh key
$cat ~/.ssh/id_rsa.pub
将生成的内容复制下来
4.打开Gerrit
用户名下面有--Settings--SSH Public Keys---Add Key---将复制的内容粘贴到空白处保存
5.下载代码:
选择 clone with commit-msg hook 与 ssh 点击复制图标;到本地打开gitbash 粘贴;第一个下拉代码遇到需要yes的地方填yes
6.完成
Linux下离线安装Git:
1.下载
https://www.kernel.org/pub/software/scm/git/
二、安装
解压:tar -vxf /usr/local/git/git-2.9.5.tar.gz
安装:
./configure --prefix=/usr/local/git
make && make install
配置环境变量:
export GIT_PATH=/usr/local/git/bin
export PATH=$JAVA_HOME/bin:$PATH:$GIT_PATH
source /etc/profile
验证:git --version
三、创建git用户,管理git服务
useradd git
passwd git
创建仓库:
mkdir -p data/git/gittest.git
git init --bare data/git/gittest.git
cd data/git/
chown -R git:git gittest.git/
四、客户端clone
git clone git@10.221.5.128:/opt/app/gitdata/gittest.git
五:问题归纳
1.bash: git-receive-pack: command not found fatal: Could not read from remote repository.
解决办法:ln -s /usr/local/git/bin/git-receive-pack /usr/bin/git-receive-pack