我正在尝试使用SSH在github上设置我的git repo的上游url。但它总是使用https网址。 我已经完成的步骤 -
git clone git@github.com:pr4bh4sh/ios-with-swift.git
并输出
$ git clone git@github.com:pr4bh4sh/ios-with-swift.git Cloning into 'ios-with-swift'...
remote: Counting objects: 117, done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 117 (delta 29), reused 103 (delta 19), pack-reused 0
Receiving objects: 100% (117/117), 467.42 KiB | 73.00 KiB/s, done.
Resolving deltas: 100% (29/29), done.
Checking connectivity... done.
git remote -v
输出
master $ g remote -v origin https://github.com/pr4bh4sh/ios-with-swift.git (fetch)
origin https://github.com/pr4bh4sh/ios-with-swift.git (push)
git config remote.origin.url
输出
git@github.com:pr4bh4sh/ios-with-swift.git
我还尝试使用git remote set-url
进行设置我可以看到,在配置中,它设置为ssh网址,但git remote -v
显示https
网址。
它发生在MacOSX el Capitan上。我也尝试过Ubuntu 15.10上的步骤,它在那里工作正常。 Ubuntu有git v2.9.3,在Mac上我试过v2.9.3和v2.10.0
我不想缓存身份验证,因此请不要建议将其作为解决方案。
答案 0 :(得分:1)
这不是正常行为。这就是我认为发生的事情。
git clone https://github.com/pr4bh4sh/ios-with-swift.git
cd ios-with-swift
git clone git@github.com:pr4bh4sh/ios-with-swift.git
git remote -v
你克隆在你的克隆里面。如果您运行git status
,您会看到:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
ios-with-swift/
nothing added to commit but untracked files present (use "git add" to track)
这是另一种选择。
git clone https://github.com/pr4bh4sh/ios-with-swift.git
git clone git@github.com:pr4bh4sh/ios-with-swift.git
cd ios-with-swift
git remote -v
第二个克隆将失败并显示“致命:目标路径'ios-with-swift'已经存在且不是空目录”但可能已被遗漏或忽略。您将使用现有的https克隆。
如果不是这些,请同时显示.git/config
和~/.gitconfig
。
答案 1 :(得分:0)
您是否尝试过直接编辑var projects = from p in projectSet
join lmp in LMProjects on p.ProjectID equals lmp.lmp_ProjectID
where p.UserID == value
select new { Project = p, LMProject = lmp };
以使用.git/config
网址?那是我的第一步。