GIT:任何设置默认登录凭据的方式? [英] GIT: Any way to set default login credentials?

查看:1044
本文介绍了GIT:任何设置默认登录凭据的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用终端for mac并运行该行

I'm using terminal for mac and running the line

git push origin master

它每次都要求我输入我的github.com用户名和密码,

是否有任何方法可以自动生成使用我的凭证?

It asks me for my github.com username and password every time,
is there any way to have it automatically use my credentials?

我一直收到错误

I keep getting the error

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

所以我将它改为

So I changed it to

[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






我将它改为


I changed it to

[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 ... 。你可以检查该文件,看看它说什么?如果你可以发布你的整个远程原点部分,那将是非常棒的。它可能看起来像这样:

From your description of things, it sounds like your [Project Dir]/.git/config file is setup with the line url = https..., and not url = git@github.com.... Can you check that file to see what it says? It'd be great if you could post your entire "remote origin" section. It probably looks something like this:

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

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

but needs to use ssh instead of http like this:

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

这篇关于GIT:任何设置默认登录凭据的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆