我在学习Git方面有一个艰难的开始,因为我在最终决定我想要它们在GitHub上之前在本地创建了一个相当大的(二十个)文件集合。我正在使用具有最新Ubuntu版本的Linux机器。这意味着关于如何将GitHub与Git一起使用的大部分介绍材料对我没有帮助,因为他们中的大多数都假设你有要在克隆的GitHub上启动的文件。克隆行为似乎是通过授予对存储库的访问权限或类似的东西来实现的。
相反,我在GitHub上注册,将我的终端导航到我要上传的文件夹,运行git init
,然后git add *
,然后git commit -m "start"
然后git push
。它给了我一些错误,不记得它在这一点上是什么,但在过去几天我一直在愚弄它试图让事情发挥作用。
这是我当前的障碍:我最近发布了拉取请求,希望以某种方式解决访问权限问题。我做了它,给了我用户名和密码,它似乎工作。但是,现在我在本地删除了一个git rm file1.txt
的文件,并且有一个文件夹,其中包含我已更改的文件。我运行git add *
和git commit -m "file cleaning"
一切正常。当我运行git push origin master
时,我收到错误
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.
我已经尝试查找有关如何处理此错误的说明,使用git remote add proj https://github.com/username/proj.git
等等,似乎无法解决问题。当我运行git config --list
时,它会打印
user.name=username
user.email=username@jemal.com
core.editor=atom
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
我尝试查找我的实际配置文件但无法导航到它们(找到/usr/bin/git/
但是这是可执行文件或它的快捷方式,不确定哪个......但它不是文件夹)并试图查找我怎么可能只使用git config ...
编辑配置,但我不知道如何。
在这一点上,我认为最好办理登机手续,看看我是否犯了一些重大或根本性的错误,而不是继续试图追逐谷歌搜索。注意:我找不到“官方”网址来尝试链接到GitHub存储库,所以我只是在地址栏中复制了地址并将.git
添加到最后。我记得多年前该网站实际上会给你一个可复制的链接,但我再也找不到了。这可能是我问题的根源。
答案 0 :(得分:2)
我已尝试查找有关如何处理此错误的说明,使用git remote add proj
https://github.com/username/proj.git
你添加了一个远程名称proj,所以你必须推送它
# push the remote named proj
git push proj master
如果您希望将proj重命名为origin,请使用以下命令:
# rename the remote
git remote rename proj origin
如果您想查看您的遥控器:
# display the list of the current remotes
git remote -v
# or:
git remote show origin