Git_can不能成功将locate更新推送到远程分支

时间:2017-12-05 14:28:13

标签: git

 $git log
 commit e9b08e2b428f9dd58aa0b792ebeb29da4270dfab (HEAD -> master)

 $git remote -v
 origin  https://github.com/Shell_learning (fetch)
 origin  https://github.com/Shell_learning (push)

 $git branch -a
 * master

 $git push -u origin master
 remote: Not Found
 fatal: repository 'https://github.com/Shell_learning/' not found

 $git remote add origin https://github.com/ekoopgj/Shell_learning
 fatal: remote origin already exists.
 #It is really strange that the repository already exists ,but I can't push my local update to remote branch.

我在github中创建了一个存储库,如下所示:

my github remote branch

所以,请告诉我这是什么问题。

2 个答案:

答案 0 :(得分:2)

您目前用于origin遥控器的网址不正确。 GitHub存储库URL的格式应遵循https://github.com/username/repository.git

定义遥控器后,您无法使用git remote add进行更改 - 您必须使用git remote set-url

此脚本应将origin更新为正确的网址。

git remote set-url origin https://github.com/ekoopgj/Shell_learning.git

答案 1 :(得分:1)

您需要将.git附加到存储库地址:

 git remote set-url origin https://github.com/ekoopgj/Shell_learning.git