简体   繁体   English

在 Colab 中将文件推送到 Git 时出错:致命:无法读取“https://github.com”的用户名:没有这样的设备或地址

[英]error when pushing files to Git in Colab: fatal: could not read Username for 'https://github.com': No such device or address

I was trying to learn github.我试图学习 github。

I have created a private repository, Repo, on github.我在 github 上创建了一个私有存储库 Repo。

I have created a folder, Folder, with some files in it in Google Drive.我在 Google Drive 中创建了一个文件夹,Folder,其中包含一些文件。

I run the following codes on Google Colab:我在 Google Colab 上运行以下代码:

%cd /content/drive/My Drive/Folder
!git init
!git config --global user.email "JohnSmith@outlook.com"
!git config --global user.name "JohnSmith"
!git add -A 
!git commit -m "first commit"

then I tried:然后我尝试了:

!git remote add origin https://<johnsmith>:<password>github@github.com/<johnsmith>/Repo.git

from which I got:我从中得到:

/bin/bash: johnsmith: No such file or directory

then I tried:然后我尝试了:

!git remote add origin https://github.com/johnsmith/Repo.git
!git push -u origin master

from which I got:我从中得到:

fatal: could not read Username for 'https://github.com': No such device or address

Note that I change the name of the Repo and usernames for privacy purpose.请注意,出于隐私目的,我更改了 Repo 的名称和用户名。

So my goal is to put the folder on Google drive in github.所以我的目标是将文件夹放在 github 的 Google 驱动器上。 How do I do it?我该怎么做?

2020 | 2020 | git v2.17.1 git v2.17.1

SOLUTION FOR:解决方案:

fatal: could not read Username for 'https://github.com': No such device or address致命:无法读取“https://github.com”的用户名:没有这样的设备或地址

Just do the following step只需执行以下步骤

1. Generate personal-access-TOKEN for github: from https://github.com/settings/tokens 1.为github生成personal-access-TOKEN:from https://github.com/settings/tokens

  1. To push changes do thing till commit as you mentioned then run the following command.如您所述,要推送更改直到提交,然后运行以下命令。

    git push https://<YOUR-PERSONAL-ACCESS-TOKEN>@github.com/<User-Name>/<Repo-Name>.git git push https://<YOUR-PERSONAL-ACCESS-TOKEN>@github.com/<User-Name>/<Repo-Name>.git


example例子

add some files or make some changes添加一些文件或进行一些更改

!git config --global user.email "JohnSmith@outlook.com"
!git config --global user.name "JohnSmith"
!git add . 
!git commit -m "first commit"
!git push https://123dpope888040e2s90136d8bxx99927@github.com/JohnSmith/hello.git

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 致命:无法读取未配置“https //github.com”设备的用户名 - Fatal: could not read username for 'https //github.com' device not configured 致命:无法读取“https://github.com”的用户名:没有这样的设备或地址 - ruby​​onrails - aws - fatal: could not read Username for 'https://github.com ': No such device or address - rubyonrails - aws (ECDSA)到已知主机列表。 致命:无法读取“https://github.com”的用户名:没有此类设备或地址 - (ECDSA) to the list of known hosts. fatal: could not read Username for 'https://github.com': No such device or address 无法读取“https://github.com”的用户名:没有这样的设备或地址 - could not read Username for 'https://github.com': No such device or address 致命:无法读取“https://github.com”的用户名:没有这样的文件或目录 - fatal: could not read Username for 'https://github.com': No such file or directory Maven发布/ Github OAuth令牌/ Jenkins:无法读取“https://github.com”的用户名:没有此类设备或地址 - Maven release / Github OAuth token / Jenkins: could not read Username for 'https://github.com': No such device or address git push错误:无法读取“ https://github.com”的用户名:权限被拒绝 - git push error: could not read Username for 'https://github.com': Permission denied Azure管道:我变得致命:无法读取“https://github.com”的用户名:终端提示被禁用 - Azure Pipelines: I am getting fatal: could not read Username for 'https://github.com': terminal prompts disabled 收到致命错误:无法读取“https://github.com”的用户名:在终端中构建项目时终端提示已禁用 - Receiving fatal: could not read Username for 'https://github.com': terminal prompts disabled while building project in terminal 尝试推送 git 并收到“无法读取 &#39;https://github.com&#39; 的用户名:终端提示已禁用” - Attempting push on git and receiving “could not read Username for 'https://github.com': terminal prompts disabled”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM