简体   繁体   English

更新远程服务器以从重命名的Git存储库中提取

[英]Updating a remote server to pull from a renamed Git repo

I have a Git repo which a remote web server is set up to pull from. 我有一个设置了远程Web服务器以从中提取的Git存储库。 When I want to update from the active branch I just log-in and run "git pull" and all is good. 当我想从活动分支进行更新时,我只需登录并运行“ git pull”,一切都很好。

I had to rename the repo on Github and updated the reference on my remote webserver using: 我不得不在Github上重命名仓库,并使用以下命令更新了远程Web服务器上的引用:

git remote set-url origin https://github.com/[organisation]/[repo]

Having done this I ran: 完成此操作后,我运行了:

git remote -v

This confirmed that the remote repo name had been updated, however when I run git pull subsequently I get the error: 这确认远程回购名称已更新,但是当我随后运行git pull时,出现错误:

The requested URL returned error: 403 Forbidden while accessing https://github.com/[organisation]/[repo].git/info/refs

What am I doing wrong? 我究竟做错了什么? Did I miss a step? 我错过了一步吗?

Ah, got it... I was using instructions pertaining to updating if you were connecting over HTTPS, not SSH. 嗯,知道了...如果您通过HTTPS而不是SSH进行连接,我正在使用有关更新的说明。 The correct command to run in that instance is: 在该实例中运行的正确命令是:

git remote set-url origin git@github.com:[organisation]/[repo].git

From: https://help.github.com/articles/changing-a-remote-s-url/ 来自: https : //help.github.com/articles/changing-a-remote-s-url/

Note: renaming the remote URL using HTTPS can work too, but you need to setup a Git credential helper . 注意:也可以使用HTTPS重命名远程URL,但是您需要设置Git凭证帮助器

That would allow to use (one time) your username/password (GitHub account credentials), which would then be cached and reused for any subsequent push/pull/clone. 这样就可以使用(一次)您的用户名/密码(GitHub帐户凭据),然后将其缓存并重新用于任何后续的推/拉/克隆操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM