修改GitHub仓库名称

1.打开仓库地址,点击Settings
在这里插入图片描述
2.更改仓库名称在这里插入图片描述
3.回到本地,通过以下命令查看之前的仓库名

$ git remote -v

查看结果:

origin	git://github.com/Chloeqq/learngit.git (fetch)
origin	git://github.com/Chloeqq/learngit.git (push)

4.通过以下命令进行修改

 git remote set-url origin git@github.com:Chloeqq/Pytest_Auto_APi_Master.git

查看结果:

git remote -v 
origin	git@github.com:Chloeqq/Pytest_Auto_APi_Master.git (fetch)
origin	git@github.com:Chloeqq/Pytest_Auto_APi_Master.git (push)
  1. 通过以下命令,推送仓库
 git push -u origin master   

发现报错

To github.com:Chloeqq/Pytest_Auto_APi_Master.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'github.com:Chloeqq/Pytest_Auto_APi_Master.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

6.上传项目

git pull --rebase origin master

发现报错

error: cannot pull with rebase: You have unstaged changes.
error: additionally, your index contains uncommitted changes.
error: please commit or stash them.

报错原因是:有未提交的更改,不能执行git pull

  • 解决方案,执行以下命令
  git stash

查看结果:

Saved working directory and index state WIP on master: da4758c add JK_AutoTest_Demo JK_Mall

重新拉取项目:

 git pull --rebase origin master

查看结果:

remote: Enumerating objects: 157, done.
remote: Counting objects: 100% (157/157), done.
remote: Compressing objects: 100% (138/138), done.
remote: Total 157 (delta 10), reused 157 (delta 10), pack-reused 0
Receiving objects: 100% (157/157), 4.03 MiB | 861.00 KiB/s, done.
Resolving deltas: 100% (10/10), done.
From github.com:Chloeqq/Pytest_Auto_APi_Master
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
Successfully rebased and updated refs/heads/master.

重新推送项目:

git push -u origin master

查看结果:

Enumerating objects: 674, done.
Counting objects: 100% (674/674), done.
Delta compression using up to 10 threads
Compressing objects: 100% (649/649), done.
Writing objects: 100% (673/673), 1.52 MiB | 1.04 MiB/s, done.
Total 673 (delta 265), reused 1 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (265/265), completed with 1 local object.
To github.com:Chloeqq/Pytest_Auto_APi_Master.git
   ecf58db..a607db9  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值