【发布时间】:2015-11-18 05:29:19
【问题描述】:
我已经将我的 private Github 存储库克隆到我的 CentOS 6 机器上(git 版本 1.7.1)。我可以以某种方式将我的本地 git 存储库设置为在输入 git push 时始终提示输入用户名和密码吗?
不会总是使用相同的用户名。
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://github.com/USER/PRIVATE-REPO.git
[branch "master"]
remote = origin
merge = refs/heads/master
当我现在执行git push 时,我得到了这个:
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/Industriromantik/render-linux.git/info/refs
fatal: HTTP request failed
如果我执行以下,则推送成功:
git push https://MY-GITHUB-USERNAME@github.com/USER/PRIVATE-REPO
...但是,如果可能的话,我只想执行git push 并提示 用户名和密码。
【问题讨论】:
-
私人意味着它只是一个您从自己的机器托管的 git 存储库?
-
您的私人仓库的设置中是否列出了任何贡献者?
-
不,我的意思是我在通过 github 网站创建存储库时选择了“私有”。
-
不,我的存储库设置中没有贡献者。
-
尝试添加贡献者,看看在尝试推送时是否会打开提示。