无法识别onedrive中的git remote

时间:2016-10-29 23:58:07

标签: git

我有一个在git中设置的项目。我正在尝试在onedrive中创建一个存储库,但是一旦创建了repo,我就无法识别它。

我在onedrive中创建了文件夹,删除了旧的源文件,并添加了新文件夹。所有这一切顺利,直到我尝试查询或执行任何操作(例如推送),我只是得到了“无法从远程存储库中读取”#39;错误。请参阅代码。

奇怪的是,git非常高兴地创建了遥控器但却无法访问它。

这是流程和代码

PS E:\ToolTrakka V7_git\tt> md   C:\users\rgudgeon.RGA\OneDrive\Development\tooltrakka_v7_repo.git


Directory: C:\users\rgudgeon.RGA\OneDrive\Development


Mode                LastWriteTime         Length   Name                                                                                
----                -------------         ------ ----                                                                                
d-----        30-Oct-16  10:08 AM                 tooltrakka_v7_repo.git                                                              



PS E:\ToolTrakka V7_git\tt> cd C:\users\rgudgeon.RGA\OneDrive\Development\tooltrakka_v7_repo.git

PS C:\users\rgudgeon.RGA\OneDrive\Development\tooltrakka_v7_repo.git> git init --bare
Initialized empty Git repository in C:/Users/rgudgeon.RGA/OneDrive/Development/tooltrakka_v7_repo.git/

PS C:\users\rgudgeon.RGA\OneDrive\Development\tooltrakka_v7_repo.git> cd "E:\ToolTrakka V7_git\tt"

PS E:\ToolTrakka V7_git\tt> git remote


PS E:\ToolTrakka V7_git\tt> git remote add origin file:\\\C:\users\rgudgeon.RGA\OneDrive\Development\tooltrakka_v7_repo.git

PS E:\ToolTrakka V7_git\tt> git remote
origin

E:\ToolTrakka V7_git\tt> git remote show origin
git : ssh: Could not resolve hostname file: Name or service not known
At line:1 char:1
+ git remote show origin
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ssh: Could not ...rvice not  known:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

PS E:\ToolTrakka V7_git\tt>  

PS E:\ToolTrakka V7_git\tt> git push -u origin master
git : ssh: Could not resolve hostname file: Name or service not known
At line:1 char:1
+ git push -u origin master
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (ssh: Could not ...rvice not   known:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

有人有任何想法吗?

关心Ray

1 个答案:

答案 0 :(得分:1)

首先,git remote add name url只是将(name, url)对添加到git config,没有验证。所以不管你给git remote add什么,它总是很乐意创造遥控器。

其次,ssh: Could not resolve hostname file: Name or service not known表明git将您的来源视为ssh协议。尝试将file:\\\更改为file:///