因此,我尝试首次使用Github。我正在开发一个由项目负责人为我创建的存储库。
我去了我想要的目录
/Users/abrahammathew/Desktop/my_issues
我创建了目录。
Abrahams-MBP:abiomed_issues abrahammathew$ git clone https://github.com/ml_projects/my_repo.git
...
Checking connectivity... done.
初始化完成
Abrahams-MBP:my_issues abrahammathew$ git init
将文件添加到我的本地存储库
Abrahams-MBP:my_issues abrahammathew$ git add my_data_extraction.py
第一次提交
Abrahams-MBP:my_issues abrahammathew$ git commit -m "first commit"
远程添加原点。
Abrahams-MBP:abiomed_issues abrahammathew$ git remote add origin https://github.com/abmathewks/my_repo.git
最后,我尝试将文件推送到github。
Abrahams-MBP:my_issues abrahammathew$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/abmathewks/my_repo.git/' not found
因此,最后一步不起作用。任何人都可以帮助诊断此问题。我已经指定了正确的仓库,所以我不确定为什么找不到它。这是我的本地目录及其内容。
Abrahams-MBP:my_issues abrahammathew$ ls -a
. my_data_extraction.py
.. my_explore.py
.DS_Store my_repo
.git
还尝试了这个:
Abrahams-MBP:my_issues abrahammathew$ git push -u origin:master
ssh: Could not resolve hostname origin: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
和一般的推动
Abrahams-MBP:my_issues abrahammathew$ git push
remote: Repository not found.
fatal: repository 'https://github.com/abmathewks/my_repo.git/' not found
问题的一部分是您正在执行几个不必要的步骤。其中一些可能会相互冲突。
要从头开始创建一个空的仓库,您可以使用
$ git init
要将新仓库连接到现有仓库,您可以
$ git remote add <name> <URL>
另一方面,当您使用以下命令克隆存储库时,无需执行以下两个步骤之一
$ git clone <URL>
这会自动初始化与git一起使用的目录,并设置一个origin
引用给定URL的远程命名。如果要添加其他遥控器,则可以使用git remote add
以外的名称origin
。
如果要从GitHub复制现有存储库,则有两个选择:
分叉GitHub存储库以创建您自己的个人副本。然后git clone
将该副本复制到您的本地计算机上使用。使用叉子的URL。
git clone
原始GitHub存储库以及原始存储库中的URL。然后创建一个新的个人仓库。您可以更改的远程URL origin
:
$ git remote set-url origin <URL>
或添加新的遥控器以指向您的新空白仓库:
$ git remote add my-personal-repo <URL>
正确创建存储库后,根据需要执行以下命令:
$ git add <file name>
$ git commit -m 'Some message'
$ git push
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句