在 GitHub 中上传文件 [已关闭]

upload file in github [closed]

提问人:zahra shokrizadeh 提问时间:11/16/2023 最后编辑:zahra shokrizadeh 更新时间:11/16/2023 访问量:53

问:


这个问题似乎与帮助中心定义的范围内的编程无关。

3天前关闭。

上传的文件是用 Windows 编写的,用 VS 编写,完成后连同这些代码一起发送到 Github。现在我做了一些更改,我想再次上传它。 我输入了相同的代码,但遇到了错误(我正在发送图像)。

我认为存储库在 Github 上可用,但我不知道在这种情况下要输入的代码。

cd project_name
git init
git checkout -b <link>
git status
git add -A
git commit -am "new version"
git remote add origin <GitHub account link>
git push origin --all


C:\Users\N\Desktop\project1>git init
Reinitialized existing Git repository in 
C:/Users/N/Desktop/project1/.git/


C:\Users\N\Desktop\project1>git checkout -b 
<link>
Switched to a new branch '<link>'



C:\Users\N\Desktop\project1>git status
On branch <link>
nothing to commit, working tree clean

C:\Users\N\Desktop\project1>git add -A


C:\Users\N\Desktop\project1>git commit -am "project1_new"
On branch <link>
nothing to commit, working tree clean



C:\Users\N\Desktop\project1>git remote add origin 
<github link>
error: remote origin already exists.


C:\Users\N\Desktop\project1>git push origin --all
Enumerating objects: 54, done.
Counting objects: 100% (54/54), done.
Delta compression using up to 8 threads
Compressing objects: 100% (50/50), done.
Writing objects: 100% (54/54), 54.84 KiB | 3.66 MiB/s, done.
Total 54 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), done.
To <github link>
 * [new branch]      check50/projects/2020/x/wiki -> 
check50/projects/2020/x/wiki
 * [new branch]      web50/project3/2020/x/search -> 
web50/project3/2020/x/search
 ! [rejected]        web50/projects/2020/x/search -> 
web50/projects/2020/x/search (fetch first)
 ! [rejected]        web50/projects/2020/x/wiki -> 
web50/projects/2020/x/wiki (fetch first)
error: failed to push some refs to 
'<github link>'
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 github cmd

评论

0赞 l4mpi 11/16/2023
解决方案已经写在你的帖子中。 “提示:更新被拒绝,因为遥控器包含您在本地没有的工作。这通常是由另一个存储库推送到同一 ref 引起的。您可能希望先集成远程更改(例如,'git pull ...'),然后再推送。如果你不明白这句话,可以看看一些基本的 git 教程。

答: 暂无答案