Visual Studio 2017 - 无法将提交的更改推送到本地存储库 [英] Visual Studio 2017 - Unable to push committed changes to local repository

查看:28
本文介绍了Visual Studio 2017 - 无法将提交的更改推送到本地存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Win 10 Enterprise 上运行 VS 2017 Enterprise (15.7.3).我在本地硬盘上有一个 git 存储库,我在其中进行了一些更改,现在希望使用 VS 将这些更改提交并推送"到位于我们的网络文件共享之一上的中央存储库.

I'm running VS 2017 Enterprise (15.7.3) on Win 10 Enterprise. I have a git repository on my local hard drive where I've made some changes and now wish to use VS to "commit and push" these changes to our central repository which is located on one of our network file shares.

我得到的错误信息是:

Error encountered while pushing to the remote repository: Git failed with a fatal error.
Could not read from remote repository.

Please make sure you have the correct access rights and the repository 
exists.

a) 直到昨天,这对我有用了一段时间.据我所知,我的机器没有更新或其他变化.

a) This has worked for me for some time up until yesterday. As far as I know, there's been no updates or other changes to my machine.

b) 当我从命令行使用 git 时,我能够将这些更改推送到我们的中央存储库,而 VS 同步窗口反映了这一事实(不再有传出提交.)

b) When I use git from the command line, I am able to push these changes to our central repository and VS Synchronization Window reflects that fact (No more outgoing commits.)

 git status before using command line to push:
     On branch master
          Your branch is ahead of 'origin/master' by 2 commits.
          (use "git push" to publish your local commits)
          nothing to commit, working tree clean
 git status after using command line to push:
     On branch master
     Your branch is up to date with 'origin/master'.
     nothing to commit, working tree clean

c) 使用 VS 安装程序,我尝试卸载(重新启动)/重新安装(重新启动)Git for Windows"但无济于事.

c) Using the VS Installer, I've attempted to uninstall (reboot) /reinstall (reboot) "Git for Windows" to no avail.

到目前为止我能找到的一切都是针对使用 GitHub 的问题,这不是我的情况.

Everything I've been able to find so far is geared towards problems using GitHub which is not my situation.

推荐答案

通过更改 Windows 设置中的凭据,上述问题已为我解决.转到控制面板 -->用户帐户 -->凭证管理器

the above issue is resolved for me by changing the credential in my windows setting. Go to Control Panel --> User Account --> Credential Manager

在凭据管理器中,您将看到 vscodevscode.github.xxx 并使用您的用户名和 GitHub 令牌对其进行编辑并保存它,然后再次尝试执行所有操作,希望这会解决问题.

In Credential Manager, you will see the vscodevscode.github.xxx and edit that with your username and GitHub token and save it and then try to do everything again hope this will resolve it.

对于 Github 访问令牌:转到 Github 设置 --->开发者设置--->个人访问令牌--->生成新令牌--->注意(命名)并勾选(repo,admin:org 和 gist),然后点击 Generate token.

For Github Access token: Go to Github Setting ---> Developer setting ---> Personal Access Token ---> Generate New Token ---> Note (Name something) and tick (repo, admin: org and gist) and click on Generate token.

现在只需在 vscodevscode.github.xxx 中使用用户名复制并粘贴此令牌.

Now just copy and paste this token with username in vscodevscode.github.xxx.

这篇关于Visual Studio 2017 - 无法将提交的更改推送到本地存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆