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保存。

1 条评论 一回 2012-03-04 23:19

本地添加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

更多相关文章

  1. 自定义的dailog
  2. android之location02
  3. 导入工程,添加jar包之后还是报错?
  4. 百度新版定位无法进入MyLocationListenner的解决办法
  5. Android日历周视图 可添加事件标记
  6. Android(安卓)Kotlin(一)
  7. ImageView添加边框
  8. Android(安卓)Studio 3.4 新特性 2019-4-20
  9. Android(安卓)ContentProvider 填删改查 实例

随机推荐

  1. Android编程心得---捕捉Home键事件的完美
  2. ANDROID笔记:shape的简单使用
  3. Android如何用checkBox实现单选
  4. Android 使用 ToneGenerator 编写按键发
  5. 【Android】setHapticFeedbackEnabled 设
  6. get screen size of android device in o
  7. Android上获取打开apk默认关联的图标.
  8. android小片段
  9. g_senser frameworks 层转屏数据流程
  10. android中关于dip和px以及转换的总结