"git@github.com:从xeropythonoauth2startermaster安装依赖项时权限被拒绝(公钥)”

2024-05-15 19:34:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用xero-python-oauth2-starter-master,但我无法通过第一步! 我在Windows上安装了Python3.8、Visual Studio代码(我也用Anaconda套装试过)和最新的Git

当我试图在requirments.txt上运行依赖项时,我得到了错误Permission denied。请参见下面的内容,这是使用Windows PowerShell(也可从cmd、Anaconda PowerShell和Anaconda cmd中试用)

PS C:\Users\m.*\OneDrive\Python\xero-python-oauth2-starter-master> pip install -r requirements.txt
Collecting flask
  Using cached Flask-1.1.2-py2.py3-none-any.whl (94 kB)
Collecting Flask-Session
  Cloning https://github.com/SqrtMinusOne/flask-session.git (to revision 560d00f1a84a9924d788a4f4e1ef35c5cf94c76d) to c:\users\m.*\appdata\local\temp\pip-install-d803d7fn\flask-session
  Running command git clone -q https://github.com/SqrtMinusOne/flask-session.git 'C:\Users\m.*\AppData\Local\Temp\pip-install-d803d7fn\Flask-Session'
  Running command git checkout -q 560d00f1a84a9924d788a4f4e1ef35c5cf94c76d
  Running command git submodule update --init --recursive -q
  git@github.com: Permission denied (publickey).
  fatal: Could not read from remote repository.

  Please make sure you have the correct access rights
  and the repository exists.
  fatal: clone of 'git@github.com:mitsuhiko/flask-sphinx-themes.git' into submodule path 'C:/Users/m.*/AppData/Local/Temp/pip-install-d803d7fn/Flask-Session/docs/_themes' failed
  Failed to clone 'docs/_themes'. Retry scheduled
  git@github.com: Permission denied (publickey).
  fatal: Could not read from remote repository.

  Please make sure you have the correct access rights
  and the repository exists.
  fatal: clone of 'git@github.com:mitsuhiko/flask-sphinx-themes.git' into submodule path 'C:/Users/m.*/AppData/Local/Temp/pip-install-d803d7fn/Flask-Session/docs/_themes' failed
  Failed to clone 'docs/_themes' a second time, aborting
ERROR: Command errored out with exit status 1: git submodule update --init --recursive -q Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.1 is available.
You should consider upgrading via the 'c:\users\m.*\appdata\local\programs\python\python38-32\python.exe -m pip install --upgrade pip' command.

{}的内容

flask
# Werkzeug<1.0  # flask-session not compatible
# see https://github.com/fengsp/flask-session/pull/114
# using patched version of flask-session
git+https://github.com/SqrtMinusOne/flask-session.git@560d00f1a84a9924d788a4f4e1ef35c5cf94c76d#egg=Flask-Session
# Werkzeug<1.0  # flask-oauthlib not compatible
# using patched version of flask-oauthlib
git+https://github.com/ageis/flask-oauthlib.git@c5ea3ace957ceeeeab3cfb6556f32685ff292eab#egg=Flask-OAuthlib

# Use development version of xero-python
#git+ssh://git@github.com/xero-github/xero-python.git@020f780b4e2b48cb33746ae19ddab9fdf128e626#egg=xero-python
xero-python==0.5.1

Tags: installpipthehttpsgitgithubcomflask
2条回答

非常确定您可以通过为github配置文件设置SSH密钥来解决这个问题

请检查是否为github配置文件设置了SSH密钥? https://github.com/settings/keys

我们在Flask会话的当前版本中遇到了一些问题,必须指向一个特定的提交并将该代码下载到我们的项目中。但为了做到这一点,您的SSH密钥需要配置

https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

试试^{}

git config  global url."https://".insteadOf "git@"
git config  global url."https://".insteadOf "ssh://git@"

这样,每个git@ssh://git@都将替换为https://

Upd

git config  global url."https://github.com/".insteadOf "git@github.com:"

git config  global url."https://github.com/mitsuhiko/flask-sphinx-themes.git".insteadOf "git@github.com:mitsuhiko/flask-sphinx-themes.git"

相关问题 更多 >