gpt4 book ai didi

Git:有什么方法可以设置默认登录凭据?

转载 作者:IT王子 更新时间:2023-10-29 00:50:01 24 4
gpt4 key购买 nike

我正在使用 mac 终端并运行该行

git push origin master

它每次都询问我的 github.com 用户名和密码,
有什么办法让它自动使用我的凭据吗?


一直报错

error: The requested URL returned error: 403 while accessing 
https://github.com/atheycreek/churchdeploy.git/info/refs

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/atheycreek/churchdeploy.git

所以我改成了

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git:github.com/atheycreek/churchdeploy.git

现在我明白了..

kirkstrobeck:churchdeploy kirkstrobeck$ git push origin master
ssh: Could not resolve hostname git: nodename nor servname provided, or not known
fatal: The remote end hung up unexpectedly

我改成了

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com/atheycreek/churchdeploy.git

现在我明白了..

kirkstrobeck:churchdeploy kirkstrobeck$ git push origin master
fatal: 'git@github.com/atheycreek/churchdeploy.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

最佳答案

根据您的描述,听起来您的 [Project Dir]/.git/config 文件是用 url = https... 行设置的,而不是 url = git @github.com...。你能检查那个文件看看它说了什么吗?如果您可以发布整个“远程来源”部分,那就太好了。它可能看起来像这样:

[remote "origin"]
url = https://github.com/atheycreek/churchdeploy.git
fetch = +refs/heads/*:refs/remotes/origin/*

但需要像这样使用 ssh 而不是 http:

[remote "origin"]
url = git@github.com:atheycreek/churchdeploy.git
fetch = +refs/heads/*:refs/remotes/origin/*

关于Git:有什么方法可以设置默认登录凭据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7842719/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com