无法在github中签入我的代码

时间:2014-09-13 19:40:05

标签: github

这是我使用GITHUB的第一天,尽管有很多谷歌搜索,我仍然坚持这个问题。她是我迄今为止所做的步骤

克隆了一个存储库

git clone https://github.com/OfficeDev/Complete-Me-Code-Sample.git

既然我不想破坏主分支,我创建了自己的分支

git branch validation

现在我切换到我的分支

git checkout validation

现在我在本地进行了所有更改。在此之后我创建了远程分支

git remote add validation https://github.com/OfficeDev/Complete-Me-Code-Sample.git

现在我尝试上传我的所有代码

git push complete-me-code-sample validation

它要求我输入用户名和密码然后给我一个错误

fatal: 'complete-me-code-sample' 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不开放吗?或者我是否需要联系该项目的所有者并要求权利?如果是的话,我应该要求什么权利?

此时此刻,我发现信息太多,而且我很难在不做PHD的情况下继续进行。

你能告诉我如何检查我的代码......以及指向一个可以教我git而没有太多RTFM的资源。

1 个答案:

答案 0 :(得分:1)

您的错误很简单且与相关,而不是。这是:

Now I made all my changes locally. After this I created the remote branch

git remote add validation https://github.com/OfficeDev/Complete-Me-Code-Sample.git

这不是你创建远程分支的方式,在这里你添加了另一个来源(命名验证),它基本上是同一个仓库的另一个克隆。你说其他仓库位于那个地址并不是真的,因为那里什么都没有。

git push如果远程分支不存在时,默认情况下会创建它,所以如果您只是跳过该步骤,那么分支就可以被创建了。

正确和优化的步骤应该是:

git clone https://github.com/OfficeDev/Complete-Me-Code-Sample.git

// Creates and changed branch at the same time
git checkout -b validation

// You'll need to commit files first, just in case you missed that
git commit -am "my sample commit"

// Depending on how you set up the repo git push could be enough
git push origin validation

试试这个,让我知道它是怎么回事。

相关问题