无法在 github 存储库中拉取或推送

Not able to pull or push in the github repository

我是 git 世界的新人。我无法理解为什么我无法在 github 存储库中拉取或推送内容。 这是克隆的 link https://github.com/Mohsin05/developer.git

我正在使用这些命令....

$ git init
$ git config --global user.name "mohsin05"
$ git config --global user.email "mohsinyounas@gmail.com"
$ git clone https://github.com/Mohsin05/developer.git
$ git remote -v
$ git add .
$ git commit -am"First"
$ git push origin master

我计算机上的文件夹已根据 github 存储库更新,但是当我对文件进行任何更改并尝试推送时出现此错误

fatal: 'origin' does not appear to be a git repository

fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists...

而且我无法创建任何新分支并且它不同步。

问题是您没有在 github 存储库的克隆上创建提交,而是在克隆 git 的父目录中的存储库上创建提交枢纽回购。这是因为您的脚本实际上在本地计算机上创建了两个 git 存储库:一个在初始目录 (git init) 中,然后一个在子目录中 (git clone)--git clone 将从 github 检出代码并将其放入调用它的子目录中。根据您的描述,您不需要执行 git init(这是为了创建一个全新的存储库)。

您真正想要的是:

git clone https://github.com/Mohsin05/developer.git
cd developer
touch First
git add First
git commit -am"First"
git push origin master

这会克隆您的 github 存储库,切换 (cds) 到存储库目录,创建一个名为 First 的文件,将其添加到存储库,使用评论 First,并将其推送到 github.