Git 仅在获取/克隆时使用SSH而不是HTTPS
我想强制所有克隆/拉取从SSH获取数据,但继续使用HTTPS进行推送 我的命令将始终使用https(Git 仅在获取/克隆时使用SSH而不是HTTPS,git,git-config,Git,Git Config,我想强制所有克隆/拉取从SSH获取数据,但继续使用HTTPS进行推送 我的命令将始终使用https(git clone https://),我无法更改这一点(许多scritps使用),但我想强制克隆使用SSH,并继续使用https进行推送 我所做的(按此顺序): 但是fetch和push都被转换为SSH: $ git remote -v origin ssh://server/repo.git (fetch) origin ssh://server/repo.git (push) 我希望看
git clone https://
),我无法更改这一点(许多scritps使用),但我想强制克隆使用SSH,并继续使用https进行推送
我所做的(按此顺序):
但是fetch和push都被转换为SSH:
$ git remote -v
origin ssh://server/repo.git (fetch)
origin ssh://server/repo.git (push)
我希望看到这样的情况:
$ git clone https://server/repo.git
$ git remote -v
origin ssh://server/repo.git (fetch)
origin https://server/repo.git (push)
使用git远程设置url--push。从文件中:
set-url
Changes URL remote points to. Sets first URL remote points to
matching regex <oldurl> (first URL if no <oldurl> is given)
to <newurl>. If <oldurl> doesn’t match any URL, error occurs and
nothing is changed.
With --push, push URLs are manipulated instead of fetch URLs.
With --add, instead of changing some URL, new URL is added.
With --delete, instead of changing some URL, all URLs matching
regex <url> are deleted. Trying to delete all non-push URLs is an error.
设置url
将远程指向的URL更改为。将第一个URL远程点设置为
匹配正则表达式(如果未给出,则为第一个URL)
到如果不匹配任何URL,则会发生错误并
什么都没有改变。
使用--push,将操纵推送URL而不是获取URL。
使用--add,将添加新的URL,而不是更改某些URL。
使用--delete,而不是更改某些URL,所有URL都匹配
正则表达式被删除。尝试删除所有非推送URL是一个错误。
使用git远程设置url——推送。从文件中:
set-url
Changes URL remote points to. Sets first URL remote points to
matching regex <oldurl> (first URL if no <oldurl> is given)
to <newurl>. If <oldurl> doesn’t match any URL, error occurs and
nothing is changed.
With --push, push URLs are manipulated instead of fetch URLs.
With --add, instead of changing some URL, new URL is added.
With --delete, instead of changing some URL, all URLs matching
regex <url> are deleted. Trying to delete all non-push URLs is an error.
设置url
将远程指向的URL更改为。将第一个URL远程点设置为
匹配正则表达式(如果未给出,则为第一个URL)
到如果不匹配任何URL,则会发生错误并
什么都没有改变。
使用--push,将操纵推送URL而不是获取URL。
使用--add,将添加新的URL,而不是更改某些URL。
使用--delete,而不是更改某些URL,所有URL都匹配
正则表达式被删除。尝试删除所有非推送URL是一个错误。
使用git远程设置url——推送。从文件中:
set-url
Changes URL remote points to. Sets first URL remote points to
matching regex <oldurl> (first URL if no <oldurl> is given)
to <newurl>. If <oldurl> doesn’t match any URL, error occurs and
nothing is changed.
With --push, push URLs are manipulated instead of fetch URLs.
With --add, instead of changing some URL, new URL is added.
With --delete, instead of changing some URL, all URLs matching
regex <url> are deleted. Trying to delete all non-push URLs is an error.
设置url
将远程指向的URL更改为。将第一个URL远程点设置为
匹配正则表达式(如果未给出,则为第一个URL)
到如果不匹配任何URL,则会发生错误并
什么都没有改变。
使用--push,将操纵推送URL而不是获取URL。
使用--add,将添加新的URL,而不是更改某些URL。
使用--delete,而不是更改某些URL,所有URL都匹配
正则表达式被删除。尝试删除所有非推送URL是一个错误。
使用git远程设置url——推送。从文件中:
set-url
Changes URL remote points to. Sets first URL remote points to
matching regex <oldurl> (first URL if no <oldurl> is given)
to <newurl>. If <oldurl> doesn’t match any URL, error occurs and
nothing is changed.
With --push, push URLs are manipulated instead of fetch URLs.
With --add, instead of changing some URL, new URL is added.
With --delete, instead of changing some URL, all URLs matching
regex <url> are deleted. Trying to delete all non-push URLs is an error.
设置url
将远程指向的URL更改为。将第一个URL远程点设置为
匹配正则表达式(如果未给出,则为第一个URL)
到如果不匹配任何URL,则会发生错误并
什么都没有改变。
使用--push,将操纵推送URL而不是获取URL。
使用--add,将添加新的URL,而不是更改某些URL。
使用--delete,而不是更改某些URL,所有URL都匹配
正则表达式被删除。尝试删除所有非推送URL是一个错误。
尽管看起来很奇怪,但您需要将https转换为https才能正常工作
[url "ssh://server/"]
insteadOf = "https://server/"
[url "https://server/"]
pushInsteadOf = "https://server/"
奇怪的是,你需要将https翻译成https才能工作
[url "ssh://server/"]
insteadOf = "https://server/"
[url "https://server/"]
pushInsteadOf = "https://server/"
奇怪的是,你需要将https翻译成https才能工作
[url "ssh://server/"]
insteadOf = "https://server/"
[url "https://server/"]
pushInsteadOf = "https://server/"
奇怪的是,你需要将https翻译成https才能工作
[url "ssh://server/"]
insteadOf = "https://server/"
[url "https://server/"]
pushInsteadOf = "https://server/"
谢谢你的回答,雷纳托。它可以工作,但对我来说不行:(我需要一些100%透明的脚本。这个'git remote set url'应该在克隆后运行,我希望避免这种情况,因为它需要大量的脚本编辑:)我需要一些只需要编辑~/.gitconfig的东西。所有脚本都在同一个user.Tks下运行,以获得您的答案,Renato。它可以工作,但对我来说不行:(我需要一些100%透明的脚本。这个'git remote set url'应该在克隆后运行,我希望避免这种情况,因为它需要大量的脚本编辑:)我需要一些只需要编辑~/.gitconfig的东西。所有脚本都在同一个user.Tks下运行,以获得您的答案,Renato。它可以工作,但对我来说不行:(我需要一些100%透明的脚本。这个'git remote set url'应该在克隆后运行,我希望避免这种情况,因为它需要大量的脚本编辑:)我需要一些只需要编辑~/.gitconfig的东西。所有脚本都在同一个user.Tks下运行,以获得您的答案,Renato。它可以工作,但对我来说不行:(我需要一些100%透明的脚本。这个'git remote set url'应该在克隆后运行,我希望避免这种情况,因为它需要大量的脚本编辑:)我需要一些只需要编辑~/.gitconfig的东西。所有脚本都在同一个用户下运行。非常酷。。。我从来没见过“代替”这个词。新工具,谢谢!完美,约阿希姆!!!成功了!真的,真的很奇怪。。。。Git总是让我惊讶:)太多了!酷!我不认为这种情况足够普遍,可以授予配置选项。我想我真的不知道大多数人使用的工作流:)非常酷。。。我从来没见过“代替”这个词。新工具,谢谢!完美,约阿希姆!!!成功了!真的,真的很奇怪。。。。Git总是让我惊讶:)太多了!酷!我不认为这种情况足够普遍,可以授予配置选项。我想我真的不知道大多数人使用的工作流:)非常酷。。。我从来没见过“代替”这个词。新工具,谢谢!完美,约阿希姆!!!成功了!真的,真的很奇怪。。。。Git总是让我惊讶:)太多了!酷!我不认为这种情况足够普遍,可以授予配置选项。我想我真的不知道大多数人使用的工作流:)非常酷。。。我从来没见过“代替”这个词。新工具,谢谢!完美,约阿希姆!!!成功了!真的,真的很奇怪。。。。Git总是让我惊讶:)太多了!酷!我不认为这种情况足够普遍,可以授予配置选项。我想我真的不知道人们使用的大多数工作流:)