git使用

git使用

本文记录的是工作中git是使用问题,无脑模式,遇到什么记录什么,谨慎阅读。

git clone时报如下错误。

git@github.com:vim/vim.git
bash: git@github.com:vim/vim.git: No such file or directory
txw95@ubuntu:~$ git clone git@github.com:vim/vim.git
Cloning into 'vim'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

原因

未将公钥加入个人git账号中。

解决方法

copy ~/.ssh/id_rsa.pub内容到git settting的SSH andGPG keys的新加SSH key中。

TortoiseGit clone时报错

disconnected no supported authentication methods available(server sent: publickey)

问题原因

TortoiseGit与Git的SSH client冲突所致。
TortoiseGit使用TortoiseGitPlink.exe这个对应putty客户端使用,需要配置.ppk文件。
而Git使用openssh方式,密钥存在于C:\User/用户名.ssh中

解决方法

1、TortoiseGit -> Settings -> Network
2、将SSH client设置成 安装目录\Git\bin\usr\ssh.exe

git log使用

git log –pretty=format:’%Cred%H%Creset -%C(yellow)%d%Creset %s %Cgreen(%an)%Creset %ad’ –abbrev-commit –date=short ./cls_api.c

git difftool 18d0264f630e200772bf236ac5747c47e908501e:./cls_api.c 5301e3e117d88ef0967ce278912e54757f1a31a2:./cls_api.c

git log 查看commit的历史
git show 查看某次commit的修改内容
git log -p 查看某个文件的修改历史
git log -p -2查看最近2次的更新内容

git回归代码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值