ChatGPT解决这个技术问题 Extra ChatGPT

Github Authentication Failed - ... GitHub does not provide shell access

$ git remote add origin git@github.com:lut/EvolutionApp.git
fatal: remote origin already exists.

$ git push -u origin master
fatal: 'EvolutionApp' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

My keys were added succesfully

 $ ssh -T git@github.com
 Hi lut! You've successfully authenticated, but GitHub does not provide shell access.

The Github article https://help.github.com/articles/generating-ssh-keys/ says that "Shell access" should not be an issue? What could the problem be?

What do you see from git remote show origin?
$ git remote show origin fatal: 'EvolutionApp' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
@SLaks it says is does not appear to be a Git repository, but previously it said that it already exists. I dont get it.

V
VonC

Try and redefine the ssh url for remote origin:

git remote set-url origin git@github.com:lut/EvolutionApp.git

And try again.

Only git remote set-url can change an existing remote URL (as opposed to git remote add, to add a new remote name and URL)
Here, the issue was the URL of the existing remote 'origin', EvolutionApp: it needed to be replaced by a valid one.
Using git config url."ssh://git@github.com/".insteadOf https://github.com/ would not have helped, considering there was no HTTPS URL in the first place.


Thanks VonC. This was driving me crazy till I found your post. Godspeed.
Why does github have within their docs that they do not allow shell access? This is confusing. help.github.com/articles/testing-your-ssh-connection
@brohjoe Because ssh -T git@github.com only gives you a "Welcome" message, not an interactive shell.
@MoshtabaDarzi I am sorry it does not work. Could you ask a separate question with more details for me or others to have a look?
git pull origin master --allow-unrelated-histories may help.
S
Sudesh Chaudhary

You can add this in the ~/.gitconfig file.

[url "ssh://git@github.com/"]
        insteadOf = https://github.com/

Now ssh will be used instead of https.


b
bSaraogi

You might have to add the remote again. That error message happens when Git doesn't know where to push to.

Use git remote -v check if the remote exists, if not, add it.

Even then if it doesn't work try removing the GIT_SSH environment variable, this maybe causing the problem.


$ git remote -v origin EvolutionApp (fetch) origin EvolutionApp (push)
Could this message that pops up when Terminal launches be causing the issue? -bash: /etc/profile.d/rvm.sh: No such file or directory
S
SLaks

This can happen if you have an incomplete remote entry in your global config.

Run git config -e --system, comment out any [remote entries, re-add the remote, and try again.


$ git config -e --system subl -w: subl: command not found error: There was a problem with the editor 'subl -w'.
Your git editor is misconfigured. Either install Sublime or configure it to use a different editor.
I ran git config --global core.editor "subl -n -w" but still get an error. I can succesfully open Sublime from Terminal with open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl I think I has something to do with my profile. Everytime I open a new terminal window I get -bash: /etc/profile.d/rvm.sh: No such file or directory
Y
Ymin Hu

check if you are using https as remote url instead of ssh. I set my remote url to http and encountered this issue. After resetting the url to ssh protocol the problem is gone.


B
Beatle Refractor

if there is trust issue for android studio or vs code project in git You can give safe permissions like below , with your project path in Ubuntu

git config --global --add safe.directory '_your_project_path'

git config --global --add safe.directory '/data/project/project/MyApp/android_app'