Windows 下git 环境搭建 与Git could not read from remote reposito问题处理Could not remove config ,gitHup删除仓库

て烟熏妆下的殇ゞ 提交于 2019-11-28 05:39:40

Windows 下git 环境搭建 与Git  could not read from remote reposito问题处理,gitHup删除仓库

 

先给大家推荐一篇博客 点击打开链接,但是不一定好用。

 

第一步:

下载mygit 下载地址:http://www.xiazaiba.com/html/25984.html

解压得到 .exe   文件根据网速,安装速度不一,耐心等待

傻瓜式安装即可.

第二步:

 

安装成功之后,打开 git bash.

    A.输入 “git config --global user.name 用户名”,“git config --global user.email 邮箱”设置用户名和邮箱.

配置好用户名和邮箱

 

第三步:需要给gitHup 账户生一个publicKey 

官方方式:

 

1. Open Git Bash.
2. Paste the text below, substituting in your GitHub email address.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

This creates a new ssh key, using the provided email as a label.
Generating public/private rsa key pair.
3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
4. At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]


看我操作图:

 

会在你的默认路径下 生成public key 文档, 

你可以选择命令的方式生成(这个方式我没成功,就不说了), 也可以使用 拷贝public Key 方式生成

id_rsa 用ultraEdit 打开:

 

整个Copy :

登录 gitHup:  找到setting 找到 SSH 我这个是已经添加好了。

点击:new ssh key

把从 id_rsa.pub 拷贝过来的 paste 到 key 中

点击Add SSH key 即可添加成功。

 

第四步 查看:

 

ssh -T git@github.com

 

第5步: 在gitHup 上创建一个库:

如果没有创建的话  CODE 那栏目 下面不会显示代码的,会显示:

 

…or create a new repository on the command line
echo "# JSProject" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:wangxiaoming/JSProject.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin git@github.com:wangxiaoming/JSProject.git
git push -u origin master

 

 

 

第6步:在本地创建一个库:

第7步:在本地创建一个

然后按照这个执行:

 

…or create a new repository on the command line
echo "# JSProject" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:wangxiaoming/JSProject.git
git push -u origin master
…or push an existing repository from the command line
git remote add origin git@github.com:wangxiaoming/JSProject.git
git push -u origin master

 

出现:

respository is already exist 问题:

解决办法:

 

 如果输入$ Git remote add origin git@github.com:djqiang(github帐号名)/gitdemo(项目名).git 

    提示出错信息:fatal: remote origin already exists.

    解决办法如下:

    1、先输入$ git remote rm origin

    2、再输入$ git remote add origin git@github.com:djqiang/gitdemo.git 就不会报错了!

    3、如果输入$ git remote rm origin 还是报错的话,error: Could not remove config section 'remote.origin'. 我们需要修改gitconfig文件的内容

    4、找到你的github的安装路径,我的是C:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\etc

    5、找到一个名为gitconfig的文件,打开它把里面的[remote "origin"]那一行删掉就好了

error:Could not remove config section 'remote.origin'. 

解决

Git clone  https://githup.com/wangxiaoming/JSProject.git

 

上传本地文件到gitHup 上 执行命令:

 

git push -u origin master

 

 

出现 could not read from remote repository:

解决办法:

 

git remote add origin https://githup.com/wangxiaoming/JSProject.git

 

操作如下:

最后看到的结果就是:

 

 

gitHup 删除仓库:

第一步:

第二步:

第三步:

 

 

 

 

 

 

 

 

 

 

 

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!