git Github Mac 权限问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25047468/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:15:16  来源:igfitidea点击:

Github Mac Permission Issue

macosgitgithubssh

提问by Muhambi

I'm using the latest Github for Mac as a new Git user. When I try to sync a repo (that I first cloned, then created a new branch, commited changes, and then merged with master), I got the error:

我正在使用最新的 Github for Mac 作为新的 Git 用户。当我尝试同步一个 repo(我首先克隆,然后创建一个新分支,提交更改,然后与 master 合并)时,出现错误:

Authentication Failed.

You may not have permission to access repo111. Check Preferences to make sure you're still logged in.

I searched for similar questions, but the answer seemed to be add SSH keys to github, so I followed: https://help.github.com/articles/generating-ssh-keys.

我搜索了类似的问题,但答案似乎是将 SSH 密钥添加到 github,所以我遵循了:https: //help.github.com/articles/generating-ssh-keys

When I do ssh -T [email protected], I get:

当我这样做时ssh -T [email protected],我得到:

Hi User111! You've successfully authenticated, but GitHub does not provide shell access.

I'm logged in as the correct user, and have rights to the repo, so I'm not sure why I'm not authenticated?

我以正确的用户身份登录,并有权访问 repo,所以我不确定为什么我没有通过身份验证?

回答by mhulse

It could be that you entered a password incorrectly and it's stored in your keychain.

可能是您输入了错误的密码并且它存储在您的钥匙串中。

For my situation, I was using GitHub for Mac to work with a BitBucket repository. Long story short, I mistyped my BitBucket password and GitHub for Mac could not authenticate (because the password stored in my keychain was wrong).

对于我的情况,我使用 GitHub for Mac 来处理 BitBucket 存储库。长话短说,我输错了 BitBucket 密码,GitHub for Mac 无法进行身份验证(因为存储在我的钥匙串中的密码错误)。

Thanks to the helpful folks at GitHub, they quickly responded when I asked for help:

感谢GitHub 上乐于助人的人们,当我寻求帮助时,他们迅速做出了回应:

Open Keychain Access.app(in /Applications/Utilities) and search for "GitHub for Mac." There should be an entry like "GitHub for Mac — bitbucket.com". Delete that entry

打开Keychain Access.app(在/Applications/Utilities)并搜索“GitHub for Mac”。应该有一个条目,如“GitHub for Mac — bitbucket.com”。删除该条目



Steps to fix if using GitHub for Mac to manage a BitBucket repo

使用 GitHub for Mac 管理 BitBucket 存储库时的修复步骤

If you see this:

如果你看到这个:

enter image description here

在此处输入图片说明

… then you might have a BitBucketkeychain/password problem.

……那么您可能遇到了BitBucket钥匙串/密码问题。

Open Keychain Access.app(in /Applications/Utilities) and search for bitbucket:

打开Keychain Access.app(在/Applications/Utilities)并搜索bitbucket

enter image description here

在此处输入图片说明

Right-click on the entry and get info:

右键单击该条目并获取信息:

enter image description here

在此处输入图片说明

Click on "Access Control" to confirm that it's truly the GitHub for Mac BitBucket password/login keychain item:

单击“访问控制”以确认它确实是 GitHub for Mac BitBucket 密码/登录钥匙串项:

enter image description here

在此处输入图片说明

Rather than deleting the keychain entry/item, I just edited my password:

我没有删除钥匙串条目/项目,而是编辑了我的密码:

enter image description here

在此处输入图片说明

You should now be able to use GitHub for Mac without authentication failures. :)

您现在应该可以在没有身份验证失败的情况下使用 GitHub for Mac。:)

回答by Nik

Had the same problem, but it was not a password problem, since other repositories worked just fine.

有同样的问题,但这不是密码问题,因为其他存储库工作得很好。

Finally compared .git/configwith a working repository and found this:

最后.git/config与一个工作存储库进行了比较,发现了这一点:

This failed:

这失败了:

[remote "origin"]
  url = [email protected]/path/to/repository

This worked:

这有效:

[remote "origin"]
  url = https://github.com/path/to/repository

Still have no idea how or why this changed.

仍然不知道这是如何或为什么改变的。

回答by strider

I had to try some other stuff after the solutions above didn't work out for me.

在上述解决方案对我不起作用之后,我不得不尝试其他一些东西。

Dont know why I got this issue, or why was fixed after:

不知道为什么我会遇到这个问题,或者为什么在之后修复了:

  1. deleting the existing keys:
  1. 删除现有的键:

.ssh/github-rsa.ssh/github-rsa.pub

.ssh/github-rsa.ssh/github-rsa.pub

  1. restarting GitHub Desktop, which automatically regens the keys
  2. add new keys to repo host (bitbucket etc)
  1. 重新启动 GitHub Desktop,它会自动重新生成密钥
  2. 将新密钥添加到 repo 主机(bitbucket 等)

回答by davidrl1000

I had the same problem, then I followed this steps:

我遇到了同样的问题,然后我按照以下步骤操作:

  1. Login to BitBucket and go to the repository you want to use Click the “Clone” button, and change the drop down option to HTTPS.
  2. Copy the command that appears (something like: git clone https://[email protected]/team-name/repository-name.git) Open terminal in your mac and navigate to wherever you want the theme files to be stored.
  3. Paste the clone command in the terminal, press enter and then enter your password when requested.
  4. In Github for Mac go to the repositories screen and click the + sign in the status bar.
  5. Select Add Local Repository – and then select the repository of the folder you want to add.
  6. Done
  1. 登录到 BitBucket 并转到您要使用的存储库 单击“克隆”按钮,并将下拉选项更改为 HTTPS。
  2. 复制出现的命令(类似于: git clone https://[email protected]/team-name/repository-name.git)在 Mac 中打开终端并导航到您想要存储主题文件的任何位置。
  3. 在终端中粘贴克隆命令,按回车键,然后在要求时输入您的密码。
  4. 在 Mac 版 Github 中,转到存储库屏幕并单击状态栏中的 + 号。
  5. 选择添加本地存储库 - 然后选择要添加的文件夹的存储库。
  6. 完毕

回答by kilinkis

If your password is correct and you still see have this problem, chances are your .git/config file has some miss configuration.

如果您的密码正确,但您仍然看到此问题,则很可能是您的 .git/config 文件有一些配置错误。

In my case, it had a pushurl value under [remote "origin"] which was not needed (I was working on a cloned project).

就我而言,它在 [remote "origin"] 下有一个 pushurl 值,这是不需要的(我正在处理一个克隆项目)。

Comment that line by adding a # before it and you are good to go :)

通过在该行之前添加 # 来注释该行,您就可以开始了:)

Also, if you get an error saying:

此外,如果您收到错误消息:

This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push

此存储库已为 Git LFS 配置,但在您的路径中未找到“git-lfs”。如果您不再希望使用 Git LFS,请通过删除 .git/hooks/pre-push 删除此钩子

just delete that by doing

只需删除它

rm .git/hooks/pre-push

rm .git/hooks/pre-push

now you are all set. This happened to me also using github desktop app for mac, with a remote bitbucket repo.

现在你已经准备好了。这发生在我身上,我也使用适用于 mac 的 github 桌面应用程序,并带有远程 bitbucket 存储库。

hint: if you commit changes and refresh bitbucket to see the changes, those might not show, but navigate to the root of the project and then back to the file and you'll see the changes. Probably some cache issue but it can drive you mad if you don't know this hint.

提示:如果您提交更改并刷新 bitbucket 以查看更改,这些更改可能不会显示,但导航到项目的根目录,然后返回到文件,您将看到更改。可能是一些缓存问题,但如果你不知道这个提示,它会让你发疯。

回答by Tushar Katyal

If you have created remote repository on GitHub and merged with local repository or project . you can add that local repository to GitHub desktop app than go to Repository > repository settings > Remote >

如果您在 GitHub 上创建了远程仓库并与本地仓库或项目合并。您可以将该本地存储库添加到 GitHub 桌面应用程序,然后转到存储库 > 存储库设置 > 远程 >

under remote You'll find primary remote repository (origin) there's a ssh remote url delete that And

在远程你会发现主远程存储库(来源)有一个 ssh 远程 url 删除,并且

  1. Go to your GitHub account.
  2. Open Your Remote repository
  3. click on Clone or Download
  4. Copy the https URL
  5. paste that in the GitHub desktop app
  6. click on fetch in the Desktop GitHub App
  7. It'll work Great :)
  1. 转到您的 GitHub 帐户。
  2. 打开您的远程存储库
  3. 单击克隆或下载
  4. 复制 https 网址
  5. 将其粘贴到 GitHub 桌面应用程序中
  6. 单击桌面 GitHub 应用程序中的 fetch
  7. 它会很好用 :)