繁体   English   中英

git如书所说,但会发生错误

[英]git as the book said but error occur

1.我只是创建并初始化一个文件夹并使其成为存储库,然后添加其中的2个文件夹。 我一次将它们提交在一起。 然后,我添加了远程存储库,但是当我开始推送它时,就会出现错误:这是我编写的代码以及以下错误:

git init
git add 2048-personal
git add canvas-time-counter
git commit
git remote add origin git@github.com:CharlesLN/front_end.git
git push -u origin master

然后错误出来了:

To git@github.com:CharlesLN/front_end.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:CharlesLN/front_end.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

然后我键入git pull然后输入信息:

warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
Unpacking objects: 100% (3/3), done.
From github.com:CharlesLN/front_end
*[new branch] master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

然后我键入git pull remote

fatal: 'remote' 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 status

所以,我不知道哪里出了问题,谁能告诉我问题所在? 谢谢!

我已经尝试了3次以上,但还是一样错误! 请给我一些帮助,谢谢!!!

看来你应该做

git pull origin master

您需要从github获得所有内容,这就是您的起源。

当vim打开时,按i并写一条短消息,然后按ESC。 要保存消息,请按

:wq

这意味着写并退出。 之后,您应该能够执行该推送。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM