From: Taylor Blau <me@ttaylorr.com>
To: "Nanekrangsan,
Sucheela (NYC-GIS)" <sucheela.nanekrangsan@interpublic.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
"Frank, Carson (OMA-GIS)" <carson.frank@interpublic.com>
Subject: Re: Git bug report git remote get-url
Date: Wed, 5 Jan 2022 19:22:23 -0500 [thread overview]
Message-ID: <YdY2P+xX/a6aHB2b@nand.local> (raw)
In-Reply-To: <00FDB880-5FF6-4C67-9144-5599B2872830@interpublic.com>
On Wed, Jan 05, 2022 at 05:22:06PM +0000, Nanekrangsan, Sucheela (NYC-GIS) wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> 1. I put [remote] entries in /etc/gitconfig
This is almost certainly the culprit.
`git remote get-url` doesn't output anything (except the error message
included in your report) when `remote->configured_in_repo` is zero.
Indeed, looking at remote.c:handle_config() where we actually add a new
remote:
remote = make_remote(remote_state, name, namelen);
remote->origin = REMOTE_CONFIG;
if (current_config_scope() == CONFIG_SCOPE_LOCAL ||
current_config_scope() == CONFIG_SCOPE_WORKTREE)
remote->configured_in_repo = 1;
we only set configured_in_repo when we're looking at local or
worktree configuration. Since $(prefix)/etc/gitconfig isn't either of
those, we'll avoid setting configured_in_repo, hence we'll end up inside
of this if-statement in builtin/remote.c:get_url():
remote = remote_get(remotename);
if (!remote_is_configured(remote, 1)) {
error(_("No such remote '%s'"), remotename);
exit(2);
}
...producing the error message in your report.
> 4. After `git remote add xxx`, I can get the URL from `git remote get-url`.
This makes sense, since `git remote add` will configure the remote `xxx`
in your repository-local configuration, not the system-wide one.
Thanks,
Taylor
prev parent reply other threads:[~2022-01-06 0:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-05 17:22 Git bug report git remote get-url Nanekrangsan, Sucheela (NYC-GIS)
2022-01-06 0:22 ` Taylor Blau [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YdY2P+xX/a6aHB2b@nand.local \
--to=me@ttaylorr.com \
--cc=carson.frank@interpublic.com \
--cc=git@vger.kernel.org \
--cc=sucheela.nanekrangsan@interpublic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).