小白教程
所有教程
关于
Search
172.70.127.5
172.70.127.5
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Git remote”的源代码
本页内容
上一节:
Git_commit_history
下一节:
Git_fetch
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:git remote}}[[Category:git basic operations|12]] = git remote 命令 = [[git basic operations|Git 基本操作]] '''git remote''' 命令用于在远程仓库的操作。 本章节内容我们将以 Github 作为远程仓库来操作,所以阅读本章节前需要先阅读关于 Github 的相关内容:[https://www.xiaobai.wang/git/git-remote-repo.html Git 远程仓库(Github)]。 显示所有远程仓库: <sample title="" desc="" lang="shell" hererun="1"> git remote -v </sample> 以下我们先载入远程仓库,然后查看信息: <sample title="" desc="" lang="shell" hererun="1"> $ git clone https://github.com/xiaobai/xiaobai-git-test $ cd xiaobai-git-test $ git remote -v origin https://github.com/xiaobai/xiaobai-git-test (fetch) origin https://github.com/xiaobai/xiaobai-git-test (push) </sample> '''origin''' 为远程地址的别名。 显示某个远程仓库的信息: <sample title="" desc="" lang="shell" hererun="1"> git remote show [remote] </sample> 例如: <sample title="" desc="" lang="shell" hererun="1"> $ git remote show https://github.com/xiaobai/xiaobai-git-test * remote https://github.com/xiaobai/xiaobai-git-test Fetch URL: https://github.com/xiaobai/xiaobai-git-test Push URL: https://github.com/xiaobai/xiaobai-git-test HEAD branch: master Local ref configured for 'git push': master pushes to master (local out of date) </sample> 添加远程版本库: <sample title="" desc="" lang="shell" hererun="1"> git remote add [shortname] [url] </sample> shortname 为本地的版本库,例如: <sample title="" desc="" lang="shell" hererun="1"> # 提交到 Github $ git remote add origin git@github.com:xiaobai/xiaobai-git-test.git $ git push -u origin master </sample> 其他相关命令: <sample title="" desc="" lang="shell" hererun="1"> git remote rm name # 删除远程仓库 git remote rename old_name new_name # 修改仓库名 </sample> 更多内容可以查看:[https://www.xiaobai.wang/git/git-remote-repo.html Git 远程仓库(Github)]。 [[git basic operations|Git 基本操作]]
返回至“
Git remote
”。
上一节:
Git_commit_history
下一节:
Git_fetch