记Github的Android项目同步到Repositories出现的问题

由于更换了Github的账号,所以准备重新配置项目到新的Repositories中,但是没想到浪费了一下的时间才彻底弄好。
按照之前上一个账号的套路

git init
git add .
git commit -m "first commit"
git remote add origin https://************.git

本来以为随手弄好的东西,却出现了下面这个fatal。

remote: Permission to TaoSunkist/AndroidCase.git denied to 943699181.
fatal: unable to access 'https://github.com/TaoSunkist/AndroidCase.git/': The requested URL returned error: 403

带着懵逼的表情开始google之旅......

Permission denied (publickey).

会有无数的人告诉你,请打开你项目根目录下的.git/config文件,将下面的这行配置

https://github.com/TaoSunkist/AndroidCase.git

更改成

[email protected]:TaoSunkist/AndroidCase.git

于是秉着求学好问的心里,我照葫芦画瓢的改好了..............................之后,再次

E:\Space\Android\StudioProjects\AndroidCase>git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

WTF?
详细请点我

Generating an SSH key

带着一脸冷淡的表情,我按照Github上Stupid教程,慢慢的开始了我的SSH-KEY生成之旅

#检验我本地是否有SSH-KEY
E:\Space\Android\StudioProjects\AndroidCase>ls -al ~/.ssh
#结果显而易见
ls: ~/.ssh: No such file or directory
#SO
E:\Space\Android\StudioProjects\AndroidCase>ssh-keygen -t rsa -b 4096 -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/asus/.ssh/id_rsa): thsunkist
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in thsunkist.
Your public key has been saved in thsunkist.pub.
The key fingerprint is:
SHA256:********************************************************** [email protected]
The key's randomart image is:
+---[RSA 4096]----+
   ╭︿︿︿╮ 
  {/ o  o /}  
   ( (oo) )   
    ︶︶︶
+----[SHA256]-----+

Okay,生成成功,紧接着我赶紧趁热将我的SSH-KEY盛入到Github的中,
并添加到我的SSH-AGENT中

E:\Space\Android\StudioProjects\AndroidCase>eval $(ssh-agent -s)
'eval' 不是内部或外部命令,也不是可运行的程序或批处理文件。

O_O|||,忘了进入gitbash的界面:

E:\Space\Android\StudioProjects\AndroidCase>bash
bash-3.1$ eval $(ssh-agent -s)
Agent pid 5840
bash-3.1$ ssh-add ~/.ssh/id_rsa
//.ssh/id_rsa: No such file or directory

居然还不存在。。。心急火燎的cd到.ssh文件夹中

E:\Space\Android\StudioProjects\AndroidCase>cd C:\Users\asus\.ssh
C:\Users\asus\.ssh>ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.

好想摇摆~~~继续跟着bash的镜头,走入楼主变态的内心世界。。。

bash-3.1$ eval $(ssh-agent -s)
Agent pid 6928
bash-3.1$ ssh-add ~/.ssh/id_rsa
//.ssh/id_rsa: No such file or directory
bash-3.1$ ssh-add id_rsa
Identity added: id_rsa (id_rsa)

好了,添加成功,测试一下能否陈宫,吕布也行。。。。

C:\Users\asus\.ssh>ssh -T [email protected]
Hi TaoSunkist! You've successfully authenticated, but GitHub does not provide shell access.

详情请看
然后愉快地洗澡睡觉~~~~

你可能感兴趣的:(记Github的Android项目同步到Repositories出现的问题)