Git:windows下远程提交代码到私人仓库

    在项目开发过程中,有时不便将代码在github公开,就可以建立private repository。但是我在本地仓库和远程私人仓库之间建立连接时遇到了一些问题,记录如下。

本地仓库和在github上建立的公共仓库之间建立连接可以用:
 

$ git remote add origin git@github.com:username/repo.git

对于私人仓库如果也用上面的代码建立关联,会在执行"git pull"或“git push”的时候报错(ssh key已配置完成):

Enter passphrase for key '/c/Users/19246/.ssh/id_rsa':
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

在网上查了一些资料,发现要用下面的代码在本地仓库和私人仓库之间建立关联:

git remote set-url origin git@github.com:username/repo.git

然后终端会显示让输入github账号的密码,输入后回车即可。

 

参考:https://github.com/akonwi/git-plus/issues/520

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值