Wait the light to fall

ssh 和 git 笔记

焉知非鱼

把旧电脑上的 .ssh 目录拷贝到新电脑上, 继续使用之前的 ssh 免密码登录提示 「权限不够或需要输入密码」, 解决办法:

chmod 755 ~/.ssh/  
chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub   
chmod 644 ~/.ssh/known_hosts 

git 回滚 #

git log # 查看提交的 commit 历史
git reset –hard 8ff24a6803173208f3e606e32dfcf82db9ac84d8

git 瘦身 #

http://blog.mallol.cn/如何给git仓库瘦身删除大文件.html

git pull 不输入密码 #

# vi .git/config

[remote "origin"]
  url = https://Username:Password@github.com/myRepoDir/myRepo.git

scp 复制文件 - 权限拒绝 #

ssh 可以登陆,但是 scp 复制文件时却不行:

$ sudo scp -P 52113  ubuntu@123.206.136.59:/tmp/*.txt .
Permission denied (publickey)

~/.ssh/config 文件中添加:

Host 123.206.136.59
IdentityFile ~/.ssh/ohmycloud