Title: can't clone use ssh key · Issue #866 · gitpython-developers/GitPython · GitHub
Open Graph Title: can't clone use ssh key · Issue #866 · gitpython-developers/GitPython
X Title: can't clone use ssh key · Issue #866 · gitpython-developers/GitPython
Description: hi~ I can't use my id_rsa key to clone my repo. this is my directory structure: ├── code ├── git_test.py ├── id_rsa ├── id_rsa.pub └── ssh_executable.sh git_test.py import os import git from git import Repo from git import Git git_url = ...
Open Graph Description: hi~ I can't use my id_rsa key to clone my repo. this is my directory structure: ├── code ├── git_test.py ├── id_rsa ├── id_rsa.pub └── ssh_executable.sh git_test.py import os import git from git im...
X Description: hi~ I can't use my id_rsa key to clone my repo. this is my directory structure: ├── code ├── git_test.py ├── id_rsa ├── id_rsa.pub └── ssh_executable.sh git_test.py import os import git from gi...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/866
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"can't clone use ssh key","articleBody":"**hi~ I can't use my id_rsa key to clone my repo.\r\nthis is my directory structure:**\r\n├── code\r\n├── git_test.py\r\n├── id_rsa\r\n├── id_rsa.pub\r\n└── ssh_executable.sh\r\n\r\n\u003e git_test.py\r\n``` python\r\nimport os\r\nimport git\r\nfrom git import Repo\r\nfrom git import Git\r\n\r\ngit_url = \"git@xxx/xxx.git\"\r\ngit_branch = \"master\"\r\nout_dir = \"./code\"\r\n\r\n# One\r\ngit_ssh_identity_file = os.path.expanduser('./id_rsa')\r\ngit_ssh_cmd = 'ssh -i %s' % git_ssh_identity_file\r\n\r\nwith Git().custom_environment(GIT_SSH_COMMAND=git_ssh_cmd):\r\n repo = Repo.clone_from(git_url, out_dir, branch=\"master\")\r\n print(\"Success\")\r\n\r\n# Two\r\nssh_executable = os.path.join(\"./\", 'ssh_executable.sh')\r\n\r\nwith Git().custom_environment(GIT_SSH=ssh_executable):\r\n repo = Repo.clone_from(git_url, out_dir, branch=\"master\")\r\n print(\"Success\")\r\n```\r\n\u003essh_executable.sh\r\n```shell\r\n#!/bin/sh\r\nID_RSA=\"./id_rsa\"\r\nexec /usr/bin/ssh -o StrictHostKeyChecking=no -i $ID_RSA \"$@\"\r\n```\r\n\r\n **I tried both methods and could not succeed clone repo....** \r\n **if I move the `id_res` `id_res.pub` to `~/.ssh`. it will success. hoping to get your help~**\r\n```\r\nTraceback (most recent call last):\r\n File \"git_test.py\", line 15, in \u003cmodule\u003e\r\n repo = Repo.clone_from(git_url, out_dir, branch=\"master\")\r\n File \"/Users/frank/miniconda3/lib/python3.7/site-packages/git/repo/base.py\", line 988, in clone_from\r\n return cls._clone(git, url, to_path, GitCmdObjectDB, progress, **kwargs)\r\n File \"/Users/frank/miniconda3/lib/python3.7/site-packages/git/repo/base.py\", line 939, in _clone\r\n finalize_process(proc, stderr=stderr)\r\n File \"/Users/frank/miniconda3/lib/python3.7/site-packages/git/util.py\", line 333, in finalize_process\r\n proc.wait(**kwargs)\r\n File \"/Users/frank/miniconda3/lib/python3.7/site-packages/git/cmd.py\", line 415, in wait\r\n raise GitCommandError(self.args, status, errstr)\r\ngit.exc.GitCommandError: Cmd('git') failed due to: exit code(128)\r\n cmdline: git clone --branch=master -v git@my.address.git ./code\r\n stderr: 'Cloning into './code'...\r\ngit@gitlab.alipay-inc.com: Permission denied (publickey).\r\nfatal: Could not read from remote repository.\r\n\r\nPlease make sure you have the correct access rights\r\nand the repository exists.\r\n```","author":{"url":"https://github.com/haofrank","@type":"Person","name":"haofrank"},"datePublished":"2019-04-29T13:22:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/866/GitPython/issues/866"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4786d0fa-1081-aa29-9237-b18b0a7b873b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF72:3DDD4:1164268:174A1A2:6A59B700 |
| html-safe-nonce | 72a511683e5fef7e230c54159236efec21e08373c69cd4bc020120e71223f6f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjcyOjNEREQ0OjExNjQyNjg6MTc0QTFBMjo2QTU5QjcwMCIsInZpc2l0b3JfaWQiOiI1MjgwOTE1MTcxMzAwNzE4MzM2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 42a0a624ec2ddafceca14d45f587ed15e073185c2578be000d40c6fc28a10937 |
| hovercard-subject-tag | issue:438312935 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/866/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9599a40958b03b6ff93a44ba0281fd7ceb1dda77077bd31c5c232ecf6023b6ef/gitpython-developers/GitPython/issues/866 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9599a40958b03b6ff93a44ba0281fd7ceb1dda77077bd31c5c232ecf6023b6ef/gitpython-developers/GitPython/issues/866 |
| og:image:alt | hi~ I can't use my id_rsa key to clone my repo. this is my directory structure: ├── code ├── git_test.py ├── id_rsa ├── id_rsa.pub └── ssh_executable.sh git_test.py import os import git from git im... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | haofrank |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab680789ae4a316cdaf0d5a292a1760140931cc4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width