Git 常用命令
日常切远程、查远程地址等速查。
切换 / 修改 origin 地址
把当前仓库的 origin 指到新地址(示例为内网 GitLab):
bash
git remote set-url origin http://{ip:port}/solarsense/frontend/solarsense-ui.git
git remote -v| 命令 | 作用 |
|---|---|
git remote -v | 查看已配置的远程名与 URL |
git remote set-url origin {远程URL} | 修改 origin 的 fetch/push 地址 |
git remote add {远程名} {远程URL} | 新增一个远程(名称不存在时) |
SSH 示例:
bash
git remote set-url origin git@{ip}:solarsense/frontend/solarsense-ui.git
git remote -v