git 基本操作命令

1. 用户名和密码设置

  # 设置用户名
    git config --global user.name "username"
  # 设置邮箱 (没有双引号)
    git config --global user.email useremail@qq.com
  # 查看用户名和密码
    git config user.name
    git config user.email
  # 查看其他配置信息(git设置列表)
    git config --list

 2. git仓库地址变更

# 1. 第一种:
$ git remote                               # 看远程仓库的名称: origin
$ git remote get-url origin                # 修改远程仓库地址
$ git remote set-url origin "新的仓库地址" 

# 2. 第二种:
$ git remote -v                 # 显示需要读写远程仓库使用的 Git 保存的简写与其对应的 URL
$ git remote rm origin          # 删除关联对应的远程仓库地址
$ git remote -v                 # 查看是否删除成功
$ git remote add "新的仓库地址"   # 重新关联git远程仓库地址
$ git remote -v                 # 查看是否关联成功

 

posted on 2022-03-24 11:00  蜗牛也是妞  阅读(49)  评论(0)    收藏  举报