Detailed explanation of git remote command

Git modifies the remote warehouse address

    1.修改命令
  git remote set-url origin [url]

  例如:$ git remote set-url origin [email protected]:php/hasoffer.git

  2.先删后加

  git remote rm origin
  git remote add origin [url]

Git checks the name of the remote warehouse and the corresponding clone address 

    1.查看远程仓库的名称

  git remote

  2.查看远程仓库的克隆地址

  git remote -v

Git adds remote warehouse

  git remote add [shortname] [url]

  例如:$ git remote add pb git://github.com/aiqinhai/ticgit.git

  解释: pb指代对应的仓库名称,我们如果推送到远程仓库,就可以选择pb这仓库,git push pb master 这样就推送到 远程pb仓库的master分之了。

Git view remote warehouse information

    git remote show [remote-name]

  例如:$ git remote show origin

    * remote origin
      Fetch URL: https://gitee.com/aiqinhai/think-in-java-4th.git
      Push URL: https://gitee.com/aiqinhai/think-in-java-4th.git
      HEAD branch: master
      Remote branch:
        master tracked
      Local branch configured for 'git pull':
        master merges with remote master
      Local ref configured for 'git push':
        master pushes to master (up to date)

Git delete remote warehouse and rename

 

    1. 删除远程仓库
      git remote rm [repository name]

    2.重命名远程仓库
      git remote rename [old name] [new name]

Guess you like

Origin blog.csdn.net/qq_28165595/article/details/130478700