拿到别人用过的电脑,如何修改成自己的git

mac2025-09-25  27

1.添加ssh key

ssh-keygen

passphrase可以为空

查看public key

cat ~/.ssh/id_rsa.pub

将public key复制到后台网站中,add push key

 

2.修改git config配置

git config --global user.name 'yourName'

git config --global user.email 'yourEmail'

git config user.name  'yourName'

git config user.email 'yourEmail'

 

3.修改push提交地址

git remote rm origin git remote add origin ssh:xxx git branch --set-upstream-to=origin/remote_branch local_branch

remote_branch:远程分支名

local_branch:该远程分支对应的本地分支名

4.修改commit的author

如果commit用的是别人的user和email,需要更改为自己的user和email,然后更改author

修改user和email见第二步

git commit --amend --reset-author

 

 

 

 

 

 

 

最新回复(0)