我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。

我打开终端使git按-f

remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found

我不确定会有什么问题。


当前回答

我在Windows10系统中也遇到过同样的问题。

这里的问题是您在系统中的用户名。您可以使用

git credential-manager uninstall

git credential-manager install

如果它不起作用,那么你必须在你的系统中安装ubuntu,在应用商店中可以买到。

在那个ubuntu终端,我强制推送存储库,它在问我用户名和Passwordstrong文本后工作

其他回答

我在Windows10系统中也遇到过同样的问题。

这里的问题是您在系统中的用户名。您可以使用

git credential-manager uninstall

git credential-manager install

如果它不起作用,那么你必须在你的系统中安装ubuntu,在应用商店中可以买到。

在那个ubuntu终端,我强制推送存储库,它在问我用户名和Passwordstrong文本后工作

所以你的url当前看起来如下所示

https://github.com/RevanthM/Log_Monitoring

它应该是这样的

https://RevanthM@github.com/RevanthM/Log_Monitoring

不同的是,在url的开头,我添加了我的github用户名,后面跟着一个@符号。

如果你正在使用Git桌面应用程序,那么你应该尝试从Git桌面应用程序中推和拉,而不是终端。它会帮助你的。

您必须生成一个新的令牌:这里的步骤是https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

在本地删除原点的控制

 git remote remove origin

再次添加它,但现在使用您生成的令牌

git remote add origin https: // <token> @ <git_url> .git

然后按一下

git pull https://@<git_url>.git

注意:

什么是git_url?是当前项目示例的url: github.com/yourUser/yourProy

并删除<>字符

有时ssh凭证是安装在你的电脑上与github回购通信。 当你设置新的repo:如果你添加了https格式的origin,你的git凭证管理器不能找出repo。

检查产地格式

git remote -v

https格式的来源

origin  https://github.com/username/repo_name.git

ssh格式的原点

origin git@github.com:username/repo_name.git

删除https格式的origin

git remote remove origin

添加ssh格式的origin

git remote add origin git@github.com:username/repo_name.git