关于远程存储库
A remote URL is Git's fancy way of saying "the place where your code is stored." That URL could be your repository on GitHub, or another user's fork, or even on a completely different server.
you can only push to two types of URL addresses:
- HTTPS URL喜欢
https://github.com/user/repo.git. - 一个ssh网址,喜欢
git@github.com:用户/ repo.git
git将远程URL与名称相关联,通常调用您的默认远程起源。
Creating remote repositories
你可以使用git remote addcommand to match a remote URL with a name. For example, you'd type the following in the command line:
git远程添加原点
这会将名称与此名称相关联起源with theremote_url.。
您可以使用命令git remote set-url到改变一个遥控器的URL。
Choosing a URL for your remote repository
有几种方法可以在github.com上克隆存储库。
当您在登录帐户时查看存储库时,您可以使用的URL将项目克隆到计算机下方的存储库详细信息下方。
有关设置或更改远程URL的信息,请参阅“管理远程存储库。“
Cloning with HTTPS URLs
这https://无论可见性如何,所有存储库都可以使用克隆URL。https://clone URLs work even if you are behind a firewall or proxy.
When yougit克隆那git fetch那git pull., 或者git push在命令行上使用HTTPS URL的远程存储库,Git将询问您的GitHub用户名和密码。当Git提示您输入密码时,请输入您的个人访问令牌(PAT)。已删除基于密码的Git身份验证,并使用PAT更安全。有关更多信息,请参阅“创建个人访问令牌。“
如果您正在访问使用SAML SSO的组织,您还必须授权您的个人访问令牌以在您进行身份验证之前访问该组织。有关更多信息,请参阅“关于SAML单点登录的身份验证“ 和 ”授权个人访问令牌与SAML单点登录一起使用。“
提示s:
- you can use a credential helper so Git will remember your GitHub credentials every time it talks to GitHub. For more information, see "缓存您在git中的github凭据。“
- To clone a repository without authenticating to GitHub on the command line, you can use GitHub Desktop to clone instead. For more information, see "将存储库从Github克隆到GitHub桌面。“
如果您愿意使用SSH但无法通过端口22连接,您可能可以在HTTPS端口上使用SSH。有关更多信息,请参阅“在HTTPS端口上使用SSH。“
用SSH URL克隆
SSH URLs provide access to a Git repository via SSH, a secure protocol. To use these URLs, you must generate an SSH keypair on your computer and add thepublickey to your account on GitHub.com. For more information, see "与ssh连接到github。“
When yougit克隆那git fetch那git pull., 或者git push对于使用SSH URL的远程存储库,系统将提示输入密码,并且必须提供您的SSH密钥密码。有关更多信息,请参阅“使用SSH密钥密码。“
如果您正在访问使用SAML单点登录(SSO)的组织,则必须在验证之前授权您的SSH键访问组织。有关更多信息,请参阅“关于SAML单点登录的身份验证“ 和 ”授权使用SAML单点登录的SSH键“在GitHub企业云文档中。
提示:您可以使用SSH URL将存储库克隆到计算机,或者作为将代码部署到生产服务器的安全方式。您还可以使用Deploy脚本使用SSH代理转发,以避免管理服务器上的键。有关更多信息,请参阅“Using SSH Agent Forwarding。“
Cloning with GitHub CLI
您还可以安装GitHub CLI以在您的终端中使用GitHub工作流程。有关更多信息,请参阅“关于GitHub Cli.。“
与颠覆克隆
you can also use a颠覆客户端访问任何再保险pository on GitHub. Subversion offers a different feature set than Git. For more information, see "What are the differences between Subversion and Git?“
您还可以从Subversion客户端访问GitHub上的存储库。有关更多信息,请参阅“Support for Subversion clients。“
