Git远程仓库地址变更本地如何修改
公司搬移, 作为git仓库的服务器IP地址变了。 本地代码挺多,重新检出太占时间,可以修改一个什么配置让我本地仓库和新的远程仓库建立关联吗, 答案是肯定的!
方法有很多,这里简单介绍几种:
 以下均以项目git_test为例:
 老地址:http://192.168.1.12:9797/john/git_test.git
 新地址:http://192.168.100.235:9797/john/git_test.git
 远程仓库名称: origin
方法一 通过命令直接修改远程地址
 进入git_test根目录
 git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址
 git remote set-url origin http://192.168.100.235:9797/john/git_test.git
 方法二 通过命令先删除再添加远程仓库
 进入git_test根目录
 git remote 查看所有远程仓库, git remote xxx 查看指定远程仓库地址
 git remote rm origin
 git remote add origin http://192.168.100.235:9797/john/git_test.git
 方法三 直接修改配置文件
 进入git_test/.git
 vim config
[core]
 repositoryformatversion = 0
 filemode = true
 logallrefupdates = true
 precomposeunicode = true
 [remote "origin"]
 url = http://192.168.100.235:9797/shimanqiang/assistant.git
 fetch = +refs/heads/*:refs/remotes/origin/*
 [branch "master"]
 remote = origin
 merge = refs/heads/master
修改 [remote “origin”]下面的url即可
方法四 通过第三方git客户端修改。
 以SourceTree为例,点击 仓库 -> 仓库配置 -> 远程仓库 即可管理此项目中配置的所有远程仓库, 而且这个界面最下方还可以点击编辑配置文件,同样可以完成方法三。
GIT 查看/修改用户名和邮箱地址
用户名和邮箱地址的作用
用户名和邮箱地址是本地git客户端的一个变量,不随git库而改变。
每次commit都会用用户名和邮箱纪录。
github的contributions统计就是按邮箱来统计的。
查看用户名和邮箱地址:
$ git config user.name
$ git config user.email
 修改用户名和邮箱地址:
$ git config --global user.name "username"
$ git config --global user.email "email"
 ————————————————
https://blog.csdn.net/asdfsfsdgdfgh/article/details/54981823
赞赏码
 
     
非学,无以致疑;非问,无以广识

 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号