V
V
VDone2022-01-26 16:03:27
git
VDone, 2022-01-26 16:03:27

I get an error when I type git push -u Error: failed to push some refs to...?

At the moment I am learning to collaborate, contribute to other repositories.
Let's say there is a VvDone/Week3Test repository , I want to contribute to this project and add a file called "newFile.js" . I push Fork , now I have a copy of this Ralbf/Week3Test repository on my account .
I'm cloning the Ralbf/Week3Test repository to my computer.
I add a new branch named "AddNewFile" . git checkout -b AddNewFile Now
I add a new file newFile.js . Indexing, committing: git add newFile.js. git commit -m "Add newFile.js"


Now I want to push the changes to the repository.
I enter the command:
git push --set-upstream origin AddNewFile.
But it doesn't work for me, because an error appears.
61f14395f2f07536036365.png

I read on the Internet that you need to enter git pull . Here is the output when I type git pull
61f1442902984869249782.png
I'm trying to type the commands that GIT suggests
1. git pull origin AddNewFile
61f14504d0101739764512.png
2. git branch --set-upstream-to origin/AddNewFile AddNewFile.
61f14564ab7d9912673826.png

help out)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Kuznetsov, 2022-01-26
@VDone

You have been carried away to the wrong steppe. I think the initial problem is that you do not have permission to write to your repository - Remote rejected. At the first push, it usually asks to log in. That was done?
There was definitely no point in creating an empty branch with the same name on github, delete it, otherwise it will interfere with sending your real local branch.
I strongly recommend installing the github command line interface , it solves many problems.

V
VDone, 2022-01-26
@VDone

This helped: How to change / delete a user in GIT
61f1aef0e667a255039826.png
Thank you all

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question