Git add remote,是必需的ssh://前缀

时间:2011-12-21 02:02:26

标签: git ssh

当添加git repo作为远程时,是否需要ssh://前缀?我一直把它看作是:

git remote add user@server.com/path/here

是否隐含了ssh://前缀?

3 个答案:

答案 0 :(得分:2)

在没有指定其他事件的情况下,Git默认为ssh协议。

http://book.git-scm.com/3_getting_a_git_repository.html

答案 1 :(得分:1)

如果你没有明确的话,Git会假设SSH

我的来源: http://progit.org/book/ch4-1.html

答案 2 :(得分:1)

好问题。这是做ssh的简便方法,但它的语法与使用SSH url协议不同。例如,使用上面的通用简写,没有空间来指定端口(假定22是最常见的并且最常见)。

有关您可以指定的各种方法的更多示例,请参阅我的博客文章,包括使用.ssh / config文件: http://readystate4.com/2011/03/30/working-with-git-repos-on-non-standard-ports/

相关问题