github 简单记录
16lz
2021-01-26
git config --global user.name "Example Surname"git config --global user.email "your.email@gmail.com"# Set default so that all changes are always pushed to the repositorygit config --global push.default "matching"
git init
git pull https://github.com/luxiaoming/ebook.git
修改 添加
git add *
git commit -m “add”
git push --set-upstream https://github.com/luxiaoming/ebook master
使用ssh方式:
生成SSHKeys
生成 SSH Keys
以 Linux Mint (Ubuntu) 为例,需要用到 ssh-keygen 命令:
ssh-keygen -t rsa -C "xian**@gmail.com" -f ~/.ssh/csser-github
简单介绍下参数含义:
-t 指定密钥类型,默认即 rsa ,可以省略-C 设置注释文字,比如你的邮箱
-f 指定密钥文件存储文件名,会生成 csser-github 和 csser-github.pub 两个密钥文件
回车后,遇到提示输入 yes 即可,剩下一路回车,密钥文件就在指定路径下生成了。
1 条评论 • 一回 • 2012-03-04 23:20将SSH公钥添加到Github
将 SSH 公钥添加到 Github
登录 Github 帐号,找到帐号设置 ->SSH Keys
点击Add New SSH Key
将本地生成的公钥文件(csser-github.pub)中的文字全选复制到key
栏,点击add key
保存。
本地添加SSH别名
本地添加 SSH 别名
如果本机有其它密钥,连接 github 时可能不会自动使用刚生成的密钥,需要设置别名:
$ sudo vi ~/.ssh/config加入类似的一段代码:
host csser-githubuser githostname github.comport 22identityfile ~/.ssh/csser-github保存退出。
3 条评论 • 一回 • 2012-03-04 23:18
测试连接
测试连接
$ ssh -T csser-github Hi csser! You've successfully authenticated, but GitHub does not provide shell access.表示设置的 SSH Keys 认证通过,但 Github 不提供 shell 访问。
此时就可以正常使用 Github 了。 最近有时间在研究hadoop,想把环境搭建起来,开始就遇到一个头疼的问题,在ubuntu 环境下用ssh服务连接loaclhost,搭建了好长时间才弄好,现在整理出来供搭建参考,现在网上有很多方法实现了master到slave实现的ssh无密码登陆,这里面就不做介绍了。废话不多说,步骤有下面几步:
步骤
1.创建密钥
~/.ssh$ ssh-keygen -t rsaGenerating public/private rsa key pair.Enter passphrase (empty for no passphrase): (忽略)Enter same passphrase again: (忽略)Your identification has been saved in /.ssh/id_rsa.Your public key has been saved in /.ssh/id_rsa.pub.
2.添加公密到信任列表
~/.ssh$ cat 192.168.1.101 >> authorized_keys
~/.ssh$
3.启动ssh-agent (以前没有做过的步骤)
如果ssh localhost返回这样的提示
Agent admitted failure to sign using the key
ps -aux|grep agent查看有无ssh-agent有无运行,若没有
~/.ssh$ ssh-agent
4.添加id_rsa到ssh-agent
~/.ssh$ssh-add id_rsa如果提示:“Could not open a connection to your authentication agent”执行:ssh-agent bash5.修改目录权限
sudo chmod 600 ~/.ssh/id_rsa sudo chmod 600 ~/.ssh/id_rsa.pubsudo chmod 644 ~/.ssh/known_hostssudo chmod 755 ~/.ssh6.登陆测试~/.ssh$ ssh localhost
更多相关文章
- 自定义的dailog
- android之location02
- 导入工程,添加jar包之后还是报错?
- 百度新版定位无法进入MyLocationListenner的解决办法
- Android日历周视图 可添加事件标记
- Android(安卓)Kotlin(一)
- ImageView添加边框
- Android(安卓)Studio 3.4 新特性 2019-4-20
- Android(安卓)ContentProvider 填删改查 实例