我已经在我的服务器上使用公钥认证有一段时间了,但是我在尝试连接到github的新“客户端”上遇到了问题。我已经阅读了许多线程来验证我的权限设置是否正确并为 github 生成了一个新密钥。我面临的问题是,即使我没有设置密码,ssh 也要求我提供密码。我什至重新制作了密钥,以 100% 确定我没有输入密码。
ssh -vvv提供以下相关输出:
debug1: Offering public key: /home/me/.ssh/github.pub
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1495
debug1: Remote: Forced command: gerve mygithubusername c3:71:db:34:98:30:6d:c2:ca:d9:51:a8:c6:1b:fc:f7
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp c3:71:db:34:98:30:6d:c2:ca:d9:51:a8:c6:1b:fc:f7
debug3: sign_and_send_pubkey
debug1: PEM_read_PrivateKey failed
debug1: read …Run Code Online (Sandbox Code Playgroud) 所以我有一个从 github 上的上游源克隆的 git 存储库。我对其进行了一些更改(在 master 分支中未提交)。我想要做的是将我的更改作为一个新分支推送到我的 github 页面上,并且让 github 仍然将其视为一个分支。
那可能吗?我对 git 和 github 相当陌生。我的问题甚至有意义吗?
我能想到的最简单的方法(我确定这是最绕的方法)是在 github 上分叉 repo。在本地将其克隆到不同的目录。添加上游源代码库。在那个新的分叉仓库中创建一个分支。将我的代码更改手动复制到新的本地存储库中。然后把它推回我的github。
这是一个常见的用例,有一种更简单的方法可以在不复制目录的情况下做到这一点吗?
我想我是在这里问而不是 SO 因为我在 linux 上使用命令行 git 并且这里的人给出了更好的答案 imo =]
有没有办法用用户名和密码来识别 github.com 服务器,以便向 github 用户帐户添加 ssh 密钥?到目前为止,我读过的所有内容都表明必须通过 Web GUI 添加用户的 ssh 密钥。我正在寻找通过命令行界面或 bash/ansible/something 脚本添加密钥的方法或过程。
我想使用 git从master-next 分支下载源代码,如Xilinx wiki 中所述。
我试过这个:
#git clone git://github.com/Xilinx/u-boot-xlnx/tree/master-next.git
Initialized empty Git repository in /home/Hannan/master-next/.git/
fatal: remote error:
Xilinx/u-boot-xlnx/tree/master-next is not a valid repository name
Email support@github.com for help
Run Code Online (Sandbox Code Playgroud)
即使这失败了:
# git clone git://github.com/Xilinx/tree/master-next/u-boot-xlnx.git
Initialized empty Git repository in /home/Hannan/u-boot-xlnx/.git/
fatal: remote error:
Xilinx/tree/master-next/u-boot-xlnx is not a valid repository name
Email support@github.com for help
Run Code Online (Sandbox Code Playgroud)
有效的命令是:
git clone git://github.com/Xilinx/u-boot-xlnx.git
Run Code Online (Sandbox Code Playgroud)
但是我怎么知道这确实会获取master-next 分支而不是master 分支?如何使用 git 正确获取特定分支?
我正在使用 RHEL 6,通过 PuTTY 访问。
通过 HTTPS 访问 Github 时出现以下错误:
error: server certificate verification failed.
CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Run Code Online (Sandbox Code Playgroud)
这是因为我在/etc/ssl/certs/. 我知道如何解决这个问题。我可以ca-certificates从 Debian 存储库安装该软件包。然而,问题是这将安装我不一定要接受/信任的所有证书(数千个)。
如何仅为 Github 安装证书?
在另一台机器上,ca-certificates已经安装了软件包并且 git 可以工作,我注意到其中的一些证书/etc/ssl/certs/是每个文件一个证书,而其他证书是一个文件中的多个证书。包含 Github 证书的特定文件包含/etc/ssl/certs/ca-certificates.crt150 多个其他证书:
$ grep 'BEGIN CERTIFICATE' /etc/ssl/certs/ca-certificates.crt | wc -l
159
Run Code Online (Sandbox Code Playgroud)
我如何才能找到这 159 个证书中的哪一个是我需要的?(除了蛮力 - 将文件切成两半并检查两半,重复while n > 1)。
我们有一个从 github 下载 mod security 的脚本,该脚本最近开始失败。服务器运行 CentOS 6,但 RHEL 6 可能有同样的问题。输出是:
# wget https://github.com/downloads/SpiderLabs/ModSecurity/modsecurity-apache_2.7.1.tar.gz
--2014-07-22 18:49:46-- https://github.com/downloads/SpiderLabs/ModSecurity/modsecurity-apache_2.7.1.tar.gz
Resolving github.com... 192.30.252.129
Connecting to github.com|192.30.252.129|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cloud.github.com/downloads/SpiderLabs/ModSecurity/modsecurity-apache_2.7.1.tar.gz [following]
--2014-07-22 18:49:47-- https://cloud.github.com/downloads/SpiderLabs/ModSecurity/modsecurity-apache_2.7.1.tar.gz
Resolving cloud.github.com... 54.230.99.219, 205.251.219.190, 54.230.97.212, ...
Connecting to cloud.github.com|54.230.99.219|:443... connected.
OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Unable to establish SSL connection.
Run Code Online (Sandbox Code Playgroud)
关于如何解决或解决此问题的任何想法?
我正在尝试开发一个工具,用于通过 API 将数据发送到 github gist。问题是 github api 将要点视为content一行,所有转义序列都按字面写出,如下所示:
{
"test.txt": {
"filename": "test.txt",
"type": "text/plain",
"language": "Shell",
"raw_url": "https://gist.githubusercontent.com/jessebutryn/5c8b2a95b4b016e2fa33edee294c732b/raw/474f72ad32c843c18e9a61a228a31df6b85a8da1/test.txt",
"size": 96,
"truncated": false,
"content": "#!/bin/sh\n\n# comment\nfunc () {\n\tfor ((i=1;i<10;i++)); do\n\t\t:\n\tdone\n}\n\nprintf '%s\\n' Foo bar baz\n"
}
}
Run Code Online (Sandbox Code Playgroud)
该内容显示如下:
#!/bin/sh
# comment
func () {
for ((i=1;i<10;i++)); do
:
done
}
printf '%s\n' Foo bar baz
Run Code Online (Sandbox Code Playgroud)
需要将其转换为:
#!/bin/sh\n\n# comment\nfunc () {\n\tfor ((i=1;i<10;i++)); do\n\t\t:\n\tdone\n}\n\nprintf '%s\\n' Foo bar baz\n
Run Code Online (Sandbox Code Playgroud)
有没有任何工具可以一次性完成此操作?sed如果没有,有谁知道如何使用标准 UNIX 工具来完成它?
注意:原始文本中的任何文字转义序列都需要进行转义,以防止 github 解释它们(但这将是一个次要问题,不一定需要在这个问题中解决,但如果有的话那就太好了) :
IE:
printf '%s\n' Foo …Run Code Online (Sandbox Code Playgroud) 这是我的 Git 存储库:
https://github.com/benqzq/ulcwe
Run Code Online (Sandbox Code Playgroud)
它有一个名为目录local,我想将其名称更改为另一个名称(比如,从local到xyz)。
通过 GitHub GUI 手动更改它是一场噩梦,因为我必须分别更改每个文件的目录名称(无论您信不信,GitHub 尚未包含“目录重命名”功能)。
安装 Git 后,我尝试了以下命令:
git remote https://github.com/benqzq/ulcwe && git mv local xyz && exit
Run Code Online (Sandbox Code Playgroud)
虽然我没有收到任何输入 GitHub 密码的提示,但我确实收到了这个错误:
fatal: Not a git repository (or any parent up to mount point /mnt/c)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Run Code Online (Sandbox Code Playgroud)
我知道 Git 的重点是下载项目、更改、测试,然后推送到托管提供商(在本例中为 GitHub),但仅更改目录,我希望直接操作。Git甚至有可能吗?
我应该使用另一个程序吗?
例如,这里有一个文件,我想通过 CLI 下载:https : //raw.githubusercontent.com/raspberrypi/linux/rpi-4.1.y/arch/arm/configs/bcmrpi_defconfig
如何下载实际文件,而不是 html?
我尝试了以下,但只得到一个 html 文件:
[pi@raspberrypi]/usr/src/linux$ wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-3.2.27/arch/arm/configs/bcmrpi_defconfig
Run Code Online (Sandbox Code Playgroud) 我可以git clone这样做...
git clone https://github.com/stackforge/puppet-heat.git
Run Code Online (Sandbox Code Playgroud)
...没有问题。但是我想排除克隆附带的所有 git meta 内容,所以我想我会使用git archive但我收到此错误:
$ git archive --remote=https://github.com/stackforge/puppet-heat.git
fatal: Operation not supported by protocol.
Run Code Online (Sandbox Code Playgroud)
任何人都知道为什么或我做错了什么?