Git尝试使用MacOS用户名而不是配置名称进行推送

时间:2018-08-26 00:29:29

标签: git macos github terminal

几天前,我成功地将其推送到存储库。我不确定发生了什么,但是现在尝试进行的尝试是

print Dumper $ses

我的Mac用户名是SlyMachine:travel-site dev$ git push origin dev@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. ,错误的第一行显示的是dev,这是我假设它是从那里获取的。

我在〜/ .gitconfig处的全局配置只有我的名字/电子邮件。

这是我在.git / config的本地配置:

dev@github.com

1 个答案:

答案 0 :(得分:0)

问题出在我的本地配置中。

[remote "origin"]
        url = ssh://github.com/danfoust/travel-site.git

我从某个地方获取了url语法,但该语法不正确或已过时。根据{{​​3}},我必须将远程用户设置为git

git remote set-url origin git@github.com:danfoust/travel-site.git

解决了这个问题。