Git 多用户配置踩坑

前言:真实搞的我晕死了。。之前已经弄过一次了,这次又搞了差不多2小时,因此记录下。

前置

git多账号配置 作者DespairC

补充

全局的config文件中

#gitee [email protected]

host gongsi
Hostname gitee.com
User li-zuohong
IdentityFile ~/.ssh/id_rsa

#gitee [email protected]
host myaccount
Hostname gitee.com
User li_zuo_hong
IdentityFile ~/.ssh/myaccount

在本地的仓库下
git init
config 文件中 如…

[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
[user]
	name = 刘青
	email = [email protected]
[remote "origin"]
	url = git@myaccount:li_zuo_hong/qingfunback.git
	fetch = +refs/heads/*:refs/remotes/origin/*

注意看上方的 remote 远程仓库的设置. 到gitee这部分 myaccount 替换原本的gitee.com 。 此时
认证就会从原本的公司账号 转为我的个人gitee账号。
接着别的操作正常进行就行了。

猜你喜欢

转载自blog.csdn.net/q1025387665a/article/details/128375828
今日推荐