我正在尝试在我的共享 linux 服务器上使用部署 php 脚本,使用 使用他们的 web-hooks 功能从 github.com pull 入一个 私有(private) 存储库,首先使用 _07910404656sh _0x1045676sh
本质上: 每次我提交到 github 时,web-hook 都会向我的 php 文件发送一个 post 请求,我想用它来发出一个简单的 git pull 命令,从而使我的服务器和 github 保持同步,这意味着我有一个不错的工作流程将帮助我停止在生产服务器上编辑内容。
我正在使用终端进行 ssh 连接。
我使用 ssh 转到我的服务器并创建了我的私有(private)存储库的克隆,这奏效了。
因此,我可以通过 ssh 连接到我的服务器并发出 git pull 并且它运行良好。但当然我想自动化这个过程。如果我能让它工作,我想对其他几个仓库做同样的事情。
我已经按照 github's guide 创建 key 并将它们添加到我在 github.com 上的帐户的 ssh keys section 中,我可以看到 key 存在于我的主机上的/.ssh/文件夹中。私钥有 chmod 600,公钥是 644。我已经删除了这些,重新创建了新的,并在 github 上多次删除/重新添加了公钥。
我目前有这些键:
1024 03:c4:16:45:40:77:a4:94:a4:... /home/username/.ssh/id_dsa (DSA)
2048 b3:62:87:e0:4b:39:aa:06:97... /home/username/.ssh/id_github (RSA)
# Default GitHub
Host github_server
HostName github.com
user git
ForwardAgent yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_github
git@github_server:username/repo cat id_github.pub >> authorized_keys
permissions denied (publickey) (我的 php 脚本会发送成功/失败的电子邮件,并且是 based on this repo :git pull 函数中使用了一个简单的 shell_exec 我已将 2>&1 添加到末尾以进行调试。 `ssh-add -l git pull 2>&1`
`Could not open a connection to your authentication agent.`
`eval $(ssh-agent) ssh-add ssh-add -l git pull`
Agent pid 944568
ssh-add: No such file or directory
-l: No such file or directory
git: No such file or directory
pull: No such file or directory
`eval $(ssh-agent) ssh-add git pull`
Agent pid 949815
git: No such file or directory
pull: No such file or directory
`eval $(ssh-agent) ssh-add -l git pull`
Agent pid 952014
The agent has no identities.
eval $(ssh-agent) ssh-add ~/.ssh/id_github git pull 2>&1
Agent pid 940365
Enter passphrase for /home/username/.ssh/id_github:
ssh-add: No such file or directory
-l: No such file or directory
git: No such file or directory
pull: No such file or directory
ps aux | grep ssh 显示列出了很多 ssh-agents。我不知道这是否有问题 940006 0.0 0.0 57708 784 ? Ss 23:22 0:00 ssh-agent
940365 0.0 0.0 57708 768 ? Ss 23:24 0:00 ssh-agent
944222 0.0 0.0 57708 784 ? Ss 23:42 0:00 ssh-agent
944568 0.0 0.0 57708 772 ? Ss 23:44 0:00 ssh-agent
944854 0.0 0.0 57708 772 ? Ss 23:45 0:00 ssh-agent
945103 0.0 0.0 57708 772 ? Ss 23:47 0:00 ssh-agent
945188 0.0 0.0 57708 784 ? Ss 23:47 0:00 ssh-agent
# ssh -i ~/.ssh/id_github -vT git@github.com OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/username/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
debug1: identity file /home/username/.ssh/id_github type 1
debug1: identity file /home/username/.ssh/id_github-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian- 5ubuntu1+github5
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1+github5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/username/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/username/.ssh/id_github
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
...
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
Hi username! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2440, received 2920 bytes, in 0.2 seconds
Bytes per second: sent 12993.2, received 15549.2
debug1: Exit status 1
eval $(ssh-agent) ssh-add ~/.ssh/id_github 在终端返回: Agent pid 958924
Enter passphrase for /home/username/.ssh/id_github: (i added passphrase)
Identity added: /home/username/.ssh/id_github (/home/username/.ssh/id_github)
git pull 命令和测试文件。极好的。Permission denied (publickey).
最佳答案
Github 还允许部署 key ,这些 key 与普通的 ssh key 相同,但通常不附带密码。我可以在没有密码短语的情况下进行部署,如我之前的问题中所述。
这似乎工作正常,所以将接受它作为答案。
关于php - 使用 ssh 从 github 部署到 linux 服务器但权限被拒绝(公钥)。 PHP脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21617043/
我正在学习如何使用Nokogiri,根据这段代码我遇到了一些问题:require'rubygems'require'mechanize'post_agent=WWW::Mechanize.newpost_page=post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708')puts"\nabsolutepathwithtbodygivesnil"putspost_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
假设我做了一个模块如下:m=Module.newdoclassCendend三个问题:除了对m的引用之外,还有什么方法可以访问C和m中的其他内容?我可以在创建匿名模块后为其命名吗(就像我输入“module...”一样)?如何在使用完匿名模块后将其删除,使其定义的常量不再存在? 最佳答案 三个答案:是的,使用ObjectSpace.此代码使c引用你的类(class)C不引用m:c=nilObjectSpace.each_object{|obj|c=objif(Class===objandobj.name=~/::C$/)}当然这取决于
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h