简体   繁体   English

权限被拒绝(公钥)。 严重的:无法从远程存储库读取

[英]Permission denied (publickey). fatal: Could not read from remote repository

I have the following in my .git/config 我的.git/config有以下内容

  1 [core]
  2     repositoryformatversion = 0
  3     filemode = true
  4     bare = false
  5     logallrefupdates = true
  6 [remote "origin"]
  7     url = git@github.com:monajalal/instagram-scraper.git
  8     fetch = +refs/heads/*:refs/remotes/origin/*

When I am trying to push the changes to the master I get this error: 当我尝试将更改推送到主服务器时,出现以下错误:

$ git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

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

I have tried these both but still get error: 我都尝试过这两个,但仍然会出错:

2150  git remote set-url origin https://github.com/monajalal/instagram-scraper.git
 2154  git remote set-url origin git@github.com:monajalal/instagram-scraper.git


mona@pascal:~/computer_vision/instagram/instagram$ git log
commit e69644389a5c7be65ae6eae14d74065e221600cb
Author: Mona Jalal <jalal@cs.wisc.edu>
Date:   Wed Mar 1 17:48:00 2017 -0600

    scrapy for instagram skeleton
mona@pascal:~/computer_vision/instagram/instagram$ git status
On branch master
nothing to commit, working directory clean


$ uname -a ; lsb_release -a
Linux pascal 3.13.0-62-generic #102-Ubuntu SMP Tue Aug 11 14:29:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

Please suggest fixes. 请提出修复建议。

If you did not properly setup your ssh key with GitHub , you can at least try with https (which you mentioned): 如果您没有使用GitHub正确设置ssh密钥 ,则至少可以尝试使用https(您提到):

git remote set-url origin https://github.com/monajalal/instagram-scraper.git

That will ask for your username ( monajalal )/password of your GitHub account. 这将要求您提供GitHub帐户的用户名( monajalal )/密码。

That will work because you own that repository, meaning you have the right to push. 这将起作用,因为您拥有该存储库,这意味着您有权进行推送。
Make sure you have made a commit locally in order to push. 确保已在本地进行提交以进行推送。

git add .
git commit -m "new commit"

git push -u origin master

The fact that you might be forced to do a git push -f means the destination (the remote GitHub repo) is not empty but includes commits of its own (typically, a README.md or a LICENSE file) 您可能被迫执行git push -f的事实意味着目的地(远程GitHub存储库)不为空,但包含其自己的提交(通常是README.mdLICENSE文件)

In that case, it is best, with Git 2.9 or more , to do: 在这种情况下,最好使用Git 2.9或更高版本

git config --global pull.rebase true
git config --global rebase.autoStash true

Then 然后

git pull

That will replay your local commits on top of those present in (and fetched form) the GitHub repo. 它将在GitHub存储库中(以获取的形式)重播本地提交。

Then a simple git push -u origin master would work. 然后,一个简单的git push -u origin master将起作用。 No need to force push your history. 无需强行推销您的历史记录。

可能不是最好的解决方案,但是考虑到我在github中创建的存储库中没有任何内容,因此我使用了以下命令,结果可以解决:

git push -f origin master

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 权限被拒绝(公钥)。 严重的:无法从远程存储库读取 - Permission denied (publickey). fatal: Could not read from remote repository Git:权限被拒绝(公钥)。 致命:无法从远程存储库读取 - Git: Permission denied (publickey). fatal: Could not read from remote repository GIT 权限被拒绝(公钥) - 致命无法从远程存储库读取 - GIT permission denied (publickey) - Fatal could not read from remote repository GitHub:权限被拒绝(公钥)。 致命:无法从远程存储库读取 - GitHub: Permission denied (publickey). fatal: Could not read from remote repository Git:权限被拒绝(公钥)致命 - 无法从远程存储库读取。 克隆 Git 存储库时 - Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository 无法从github提取更改-权限被拒绝(公钥)。 严重的:无法从远程存储库读取 - can't pull changes from github - Permission denied (publickey). fatal: Could not read from remote repository Jenkins:权限被拒绝(公钥,密码)。 严重的:无法从远程存储库读取 - Jenkins: permission denied (publickey, password). fatal: Could not read from remote repository Heroku'权限被拒绝(publickey)致命:无法读取远程存储库的问题 - Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes Git 子模块:git@github.com:权限被拒绝(公钥)。 致命:无法从远程存储库中读取 - Git submodule: git@github.com: Permission denied (publickey). fatal: Could not read from remote repository git@gitlab.com:权限被拒绝(公钥)。 致命:无法从远程存储库读取 - git@gitlab.com: Permission denied (publickey). fatal: Could not read from remote repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM