2

I am trying to use xero-python-oauth2-starter-master but I cant get past the first step! I am on Windows and i have installed python 3.8, Visual Studio Code (I also tried this with the Anaconda suit) and latest Git.

When i try to run the dependencies on requirments.txt I get the error Permission denied. Please see below This is from using Windows PowerShell (also tried from cmd, Anaconda PowerShell and 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.

Contents of requirments.txt

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
davidism
  • 121,510
  • 29
  • 395
  • 339
Mike
  • 67
  • 6
  • Edit `requirements.txt`, change all entries of `git@github.com:` to `https://github.com/` should correct the permission issue, or simply modify any usage of `git+ssh://git@` to `git+http://`. – metatoaster Aug 06 '20 at 11:34
  • I don't have `git@github.com:` or `git+ssh://git@` – Mike Aug 06 '20 at 11:42
  • You don't, but one of the dependencies listed, `flask-session`, does via its [`.gitmodules`](https://github.com/SqrtMinusOne/flask-session/blob/560d00f1a84a9924d788a4f4e1ef35c5cf94c76d/.gitmodules). – metatoaster Aug 06 '20 at 11:54
  • I dont understand what i must do – Mike Aug 07 '20 at 09:50
  • So because of that dependency it continued to give an error so i added the below on ~/.gitconfig `[url "https://"] insteadOf = ssh://git@ insteadOf = git@ [url "https://github.com/mitsuhiko/flask-sphinx-themes.git"] insteadOf = git@github.com:mitsuhiko/flask-sphinx-themes.git` so its not really a solution but it works – Mike Aug 07 '20 at 11:55

2 Answers2

0

Try git config url.<URL>.insteadOf:

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

This way every git@ and ssh://git@ will be replaced with 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"
phd
  • 82,685
  • 13
  • 120
  • 165
  • I did that and now i get this error `fatal: unable to access 'https://github.com:mitsuhiko/flask-sphinx-themes.git/': URL using bad/illegal format or missing URL` This is the original in the git sub-module `git@github.com:mitsuhiko/flask-sphinx-themes.git` – Mike Aug 07 '20 at 09:50
  • i just replaced the whole thing to the correct format in .gitconfig and it worked ok. Thank you – Mike Aug 07 '20 at 11:55
  • Oops, sorry, it must be `https://github.com/mitsuhiko/flask-sphinx-themes.git`. Added to the answer. – phd Aug 07 '20 at 12:42
0

Pretty sure you can resolve this by setting up your SSH keys for your github profile.

Please check that your SSH keys are setup for your github profile? https://github.com/settings/keys

We ran into some issues with the current version of Flask-Session and had to point to a specific commit and download that code into our project. But in order to do that your SSH keys need to be config.

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