我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。
我打开终端使git按-f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定会有什么问题。
我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。
我打开终端使git按-f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定会有什么问题。
当前回答
在我的情况下,我需要在Linux上使用Ctrl + H打开目录来查看隐藏的文档,所以我进入Git配置并在URL中取出。Git。
其他回答
在我的情况下,我不能克隆github由于用户是错误的。
转到~/.gitconfig 然后尝试删除这行代码(只需删除它,然后保存文件)。
[user]
name = youruser
email = youruser@domain.com
或者尝试在CMD或终端中使用一行代码:git config——global——remove-section user
并尝试再次做git克隆。希望它能帮你度过美好的一天。><
在Windows上:
进入。git文件夹 使用记事本或任何其他编辑器打开“配置”文件 将您的URL从https://github.com/username/repo_name.git更改 https://username: password@github.com/username/repo_name.git
保存并推送代码,它将工作。
虽然前面的回复提供了各种解决方案,但我发现其中最简单的一个是将用户名添加到存储库的URL中
git remote add origin https://your-username@github.com/your-username/repository-name.git
如果你已经定义了存储库(没有添加用户名),你可以按照以下方式更新它:
git remote set-url origin https://your-username@github.com/your-username/respository-name.git
当推送到远程存储库时,git不会从凭据助手中提取任何其他现有存储库的凭据,而是会询问用户/存储库在URL中定义的特定密码。
一般来说,我会不惜一切代价避免使用您的帐户密码,而是使用个人访问令牌。登录github,选择,
Settings > Developer Settings > Personal Access Tokens > Generate new token
只要确保在定义令牌范围时选中repo,并在要求输入密码时输入令牌(而不是您的个人密码)。
操作系统
使用VS Code和一个没有密码的密钥:
removed eval "$(ssh-agent -s)" line from my ~/.zshrc file to stop running it in the background (first step on Github's Generating a new SSH key article) verified my .ssh/config entry for *.github.com did not have a UseKeychain line used simply ssh-add ~/.ssh/id_ed25519 with NO --apple-use-keychain on VS Code "Git: Add remote..." allowed/authorized my Github account connection (you don't really need to add a remote) applies a new "vscodevscode.github-authentication" entry in Mac's Keychain Access app closed all shells and VS Code, restarted and the repo is now always found
您可能正在尝试推送到私有存储库。在这种情况下,您必须请求管理员验证Collaborator访问。