git 原点映射到什么,如何找出

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11093080/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:05:18  来源:igfitidea点击:

What is origin mapped to, how to find out

git

提问by James Raitsev

Say you

说你

git remote add origin [email protected]:myRepo.git

And then .. you know .. you forget what exactly originis mapped to :(

然后..你知道..你忘记了到底origin映射到了什么:(

How can you find out?

你怎么知道?

回答by Ashe

git remote -v

will list them. The source for this information can be seen by inspecting .git/config:

将列出它们。可以通过检查来查看此信息的来源.git/config

cat .git/config

The configfile in the .gitdirectory at the base of your repository contains all the configuration in a plain-text format.

config在该文件.git在您的代码库的目录包含在纯文本格式的所有配置。

You'll see something like this:

你会看到这样的事情:

[remote "origin"]
        url = [email protected]:myRepo.git
        fetch = +refs/heads/*:refs/remotes/origin/*

The urlline (in git config parlance, the value of remote.origin.url) contains the remote URL.

url行(用 git config 的说法是 的值remote.origin.url)包含远程 URL。

The other way to find out is by executing git config remote.origin.url:

另一种找出方法是执行git config remote.origin.url

$ git config remote.origin.url
[email protected]:myRepo.git
$ 

回答by Felix Kling

You can run the following command:

您可以运行以下命令:

git remote -v

to get a list of all remotes with their URL.

获取所有遥控器及其 URL 的列表。

From the man-page:

从手册页:

OPTIONS
-v, --verbose
Be a little more verbose and show remote url after name. NOTE: This must be placed between remote and subcommand.

COMMANDS
With no arguments, shows a list of existing remotes. Several subcommands are available to perform operations on the remotes.

选项
-v, --verbose
稍微详细一点并在名称后显示远程 url。注意:这必须放在远程和子命令之间。

命令
不带参数,显示现有遥控器的列表。几个子命令可用于在遥控器上执行操作。

回答by Andrew Marshall

git remote -v

will give a list of all remote along with their corresponding URLs. You can find out even more information about the remote by doing

将列出所有遥控器及其相应的 URL。您可以通过执行以下操作找到有关遥控器的更多信息

git remote show origin

Read more in the man page for git-remote.

在 的手册页中git-remote阅读更多信息。