git 修改远程仓库地址,修改用户名和邮箱

69 阅读1分钟

命令行修改远程仓库地址

git remote set-url origin 远程仓库地址

修改配置文件

//  .git>config 文件

[core]
  repositoryformatversion = 0
  filemode = true
  logallrefupdates = true
  precomposeunicode = true

[remote "origin"]
  # 修改成新的仓库地址
  url = 远程仓库地址
  fetch = +refs/heads/*:refs/remotes/origin/*

[branch "master"]
  remote = origin
  merge = refs/heads/master

修改用户名和邮箱

打开终端,输入

// 查看用户名
git config user.name
// 修改用户名
git config user.name 你的用户名
// 查看邮箱
git config user.email
// 修改邮箱
git config user.email 你的邮箱

建议在自己的电脑上使用全局配置

// 修改用户名
git config --global user.name 你的用户名
// 修改邮箱
git config --global user.email 你的邮箱