I’m new to this.
I downloaded files from the repository and made changes to them. I want to upload them back to the same repository and overwrite the old files with the updated versions, OR add the changed version as a folder in the repository without altering the old files, OR add them to a totally new branch. All i want is to put the files there so other group project members can access them to work on the project and I’m not picky about the form that takes.
I don’t want the old files back on my local drive because I’ve already changed them and don’t want to overwrite the changes I’ve made
git init (normal behavior)
git add . (normal behavior)
git commit -m “commit message” (returns: “On branch master nothing to commit, working tree clean”)
git push -u origin master (returns: “! [rejected] master -> master (non-fast-forward) error: failed to push some refs to ‘[the url]’ hint: updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. ‘git pull…’) before pushing again. See the 'Note about fast-forwards in ‘git push --help’ for details. [some URLs] fatal: invalid refspec [the URL]”)
git pull origin master (fatal: invalid refspec [some URLs] redirecting to [the URL] from [another URL] * branch master -> FETCH HEAD fatal: refusing to merge unrelated histories")
I stumbled around before and accidentally got a previous version to upload by using a command with “rename” in it but I forget what I did. This is what happened when I tried to do it again.
git remote rename origin origin-old (no errors)
git push origin master (“fatal: ‘origin’ does not appear to be a git repository could not read from remote repository. please make sure you have the correct access rights and the repository exists”)
git add . (no error)
git add -u origin master (“fatal: pathspec ‘origin’ didn’t match any files”)
git commit -m “commit message” ("On branch master nothing to commit, working tree clean)
git push origin master ("fatal: origin does not appear to be a git repository. Please make sure you have the correct access rights and the repository exists.)
I looked at git --help but I don’t know what I’m trying to do other than commit the changes and push them. I made a branch on the web interface thinking I could push to that without it complaining but that’s not turning out to be true.
How can I prevent going through this and spending hours trying to push my updates?
EDIT: apparently I was supposed to pull the files instead of download them from the web interface, but now that it’s like that, how do I make it so it will push?