用ssh方式git clone ssh,能不每次都输密码吗

当前访客身份:游客 [
当前位置:
之前用的https方式,每次需要输入用户名和密码。网上搜说是换成ssh方式就不用了。可是我还是需要输入ssh的密码。
是ssh方式还需要调权限吗?&
共有6个答案
<span class="a_vote_num" id="a_vote_num_
重新生成一个没有密码的公钥和私钥就好了
--- 共有 5 条评论 ---
: /questions/112396/how-do-i-remove-the-passphrase-for-the-ssh-key-without-having-to-create-a-new-ke
(1年前)&nbsp&
: 我重生了一个无密码的密钥,能不能给个删密码的网址我呢?
(1年前)&nbsp&
: 或者用ssh-agent
(1年前)&nbsp&
(1年前)&nbsp&
正准备试这个。但有没有方法去掉密钥的密码呢
(1年前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
使用 ssh 方式登录需要配置 key,还有git的配置文件里要打开 ssh验证的选项,你可以百度去找个教程。
--- 共有 1 条评论 ---
我在账户下配了ssh公钥,~/.ssh/config里url是ssh的地址。
(1年前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
你自己的私钥有密码,去掉私钥的密码就无密码验证了
--- 共有 1 条评论 ---
私钥?我之前只设了一个公钥。没有找到去密码的地方....
(1年前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
--- 共有 1 条评论 ---
是在网页上的ssh公钥配吗?这个我有按照网上的步骤,配置。
(1年前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
免密码访问git库&
windows 用户目录下创建_netrc&
非windows 用户目录下&创建&.netrc,设置权限 600&
login username
password password
--- 共有 2 条评论 ---
这个方法很方便
(1年前)&nbsp&
正解,不过别人用你电脑的时候可能知道你的用户名密码哟。这样用的话,千万不要把电脑借给别人
(1年前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
用https方式,clone公有库不需要验证密码
更多开发者职位上
有什么技术问题吗?
dubowen...的其它问题
类似的话题git clone ssh permission denied - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
I followed the instruction at
and typing
I get the message
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
When I try to clone a repository using ssh
git clone ssh:///username/repository.git
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
ssh-add -l
I see 3 keys one attached with my email address (k1) and other 2 inside ~/.ssh/id_rsa (RSA) (k2 and k3).
the key k3 is the same of k1
everything is fine...the only line that makes me thinking is
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
git clone ssh:///username/repository.git is wrong. You should be doing:
git clone ssh:///username/repository.git
or better yet:
git clone :username/repository.git
137k22250277
This terribly nondescript error means that the server rejected your connection. Github has a very rich documentation this -
Check if the keys and token are setup properly as per the instructions provided by GitHub. If I were you, start from scratch again. May be you haven't properly initialized SSH keys with Github -
cd ~/.ssh && ssh-keygen
cat id_rsa.pub
and copy the key into the SSH settings of the Github website.
To clone a Git repository over SSH, you specify ssh:// URL like this:
$ git clone ssh://user@server/project.git
or you can use the shorter scp-like syntax for SSH protocol:
$ git clone user@server:project.git
Just wanted to make sure you're copying a correct SSH clone URL from your Github account -
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you&#39;re looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabledTortoiseGit + msysgit 记住帐号密码方法及使用密匙的方法 | ZWWoOoOo
You are here:
& TortoiseGit + msysgit 记住帐号密码方法及使用密匙的方法
TortoiseGit + msysgit 记住帐号密码方法及使用密匙的方法
Windows 重度用户只能用 for windows 的软件了,所以虽然使用 Git,但还是要找专门的 windows 版本。
最近开始使用 GitHub 来托管一些小项目/兴趣,而自己是重度 win 用户,所以完全命令行总是不习惯(好吧,懒得记命令)。然后我用 GitHub for Windows 来管理,不过觉得不是特别顺手,最后转用 TortoiseGit + msysgit,毕竟一直在使用 TortoiseSVN。
具体配置和使用方法我就懒得写,我也不熟悉,反正网上一大堆。这里说说碰到的一个小问题:使用 TortoiseGit 每次“推送”都要输入用户名和密码比较烦,所以想找找可以记住账户密码的方法,然后放G搜,搜了2个方法记录一下
注意:这2个方法有安全性的问题,自己拿捏是否使用,反正我的电脑就我一个人用,而且项目都是自个兴趣玩的,无所谓了,方便即可。
1. 查看 Windows 的环境变量,看看你的 HOME 环境变量,如果没有自己建一个 HOME 环境变量,值为 %USERPROFILE%
2. 进入这个用户目录,新建一个名为“_netrc”的文件
3. 用记事本/编辑器打开 _netrc 文件,输入Git服务器名、用户名、密码(如下格式),并保存。
#git服务器名称
login user
password pwd
1. 同“方法一" 的 1
2. 进入这个用户目录,打开 .gitconfig 增加:
[credential]
helper = store
或者具体某项目记住账号/密码:进入修改“项目/.git/config”,增加
[credential]
helper = store
这样设置后看,只要一次输入就会记住了。不过再次说明,这个是用明文记住账户和密码的,所以安全性就自己看着办吧。
OK,继续折腾。
===============================================
其实最好还是用密匙方法,因为我设置密匙方法时犯了个低级错误:就是 git 地址使用了 https 而不是 git …… 超囧~
下面记录一下 TortoiseGit 使用密匙方法 push(推送)的步骤:(简单说明)
1. 打开 TortoiseGit 附带工具 Puttygen(PuTTY Key Generator)【开始菜单 》TortoiseGit 》Puttygen】
2. 点击“Generate”,然后开始生成随机密匙,生成过程中在“Public key for pasting into OpenSSH authorized_keys file:”下面移动鼠标指针加快生成速度
3. 完成后可以按“Save private key”保存密匙文件,保存前会提示你没有输入 Key passphrase 密码,这个根据自己需求来决定设定不设定,我就懒得设定了。输入文件名保存密匙(这里假定保存在 D:\TortoiseGit.ppk)。注意,先不要关闭“PuTTY Key Generator”
并登陆到你的账户,然后点 Account Setting,左边点 SSH Keys,接着点击 Add SSH Key,把“Public key for pasting into OpenSSH authorized_keys file:”下面生成的那么一大串(ssh-rsa开头)复制到Key框,Title随便取名,按 Add key 提交。
5. clone 项目时要用“:用户名/项目名”
6. 懒得截图也麻烦,好难说明,这样吧,直接进入已 clone 到本地的项目目录下的 .git 目录,打开 config,在 [remote "origin"] 下面添加:
puttykeyfile = D:\\TortoiseGit.ppk
随便补完了,如果不太懂的自行搜索图文版吧,呼~ 哦,这里有非常详细的 TortoiseGit 安装设置教程:/JiapengLi/GitTutorial,早知道就贴个地址,囧~
声明: 除非注明,文章均为原创,转载请以链接形式标明本文地址本文地址:
Related Posts
Most Popular
Leave a Reply之前开始用github时是在ubuntu下按着搞定的。但最近一直在用fedora,所以也想在fedora下用github,配置的时候很顺利,就是在git push的每次都需要输入username和password,而我是配置好公钥登陆的。用ssh -T
也是成功用公钥登陆的。
查看了下~/.gitconfig,发现和ubuntu下的一样,google看到一篇,里面说了git push的两种方式,SSH方式和HTTPS方式。
在版本库的SSH方式和HTTPS方式是不同的,具体来说就是url信息的不同,但是,实际的认证机制也是不同的。当建立了本机密钥之后,使用ssh方式实际上是不需要再次认证的,而https则每次需要输入密码 。里也说了用SSH更方便更安全,不需要去输入长长的密码。
我去看了下repo目录下的.git/config,果然,我的url是HTTPS形式。
[remote "origin"]
fetch = + refs/heads/*:refs/remotes/origin/*
url = /username/projectname.git
因为远程版本库的url是HTTPS,估计是我git clone的时候用HTTPS链接造成的
所以问题就出在这了,每次都很不方便,都要输入用户名和密码。
为了使用SSH公钥的方式认证,我把config的url改成下面这样
[remote "origin"]
fetch = + refs/heads/*:refs/remotes/origin/*
url = :username/projectname.git
这样我git push的时候又可以用SSH公钥认证而不用去输入用户名和密码,不仅方便,而且更安全。
阅读(...) 评论()

我要回帖

更多关于 git clone ssh 的文章

 

随机推荐