当时在学校机房创建的项目,后来在在自己电脑上提交 就老是 在命令 git push -u origin master
卡住 不上去
附加 提交命令如下
cd existing_folder
git init
git remote add origin git@gitlab.starobserve.com:android_ui_cs_56/something.git
git add .
git commit -m "Initial commit"
git push -u origin master
git push 出现SSH警告 :
The authenticity of host ‘github.com (xx.xx.xx.xx)’ can’t be established.
输入yes之后
继而出现gitlab.starobserve.com's password
提示需要输入什么认证密码的
Please make sure you have the correct access rights and the repository
exist
才发现是公钥出现了问题,要先设置用户和邮箱再重新生成ssh公钥即可。
解决步骤
1.要重新生成公钥,所以先删除.ssh文件夹(c:/user/.ssh),手动删除就好
2.gitbash 输入命令
2.1设置信息
git config --global user.name “yourname” git config --global
user.email “your@email.com”
//yourname是 gitlab的用户名,your@email是gitlab的邮箱
2.2.紧接着生成ssh
ssh-keygen -t rsa -C “your@email.com”(输入自己的邮箱)
后面出现的直接回车就可以
3.查看公钥
在c:/user/.ssh找到ssh文件夹
用记事本打开id_rsa.pub,复制全部内容
点击右上角头像进入setting->左边菜单栏点击 ssh keys
紧接着 在your ssh key会有 多出一个新的ssh!!
接着push上去就可以顺利了!