I'm taking a free, virtual Harvard CS course and am trying to submit a project: that is, a directory called "search." The instructions to submit are:
git init
git remote add origin https://github.com/me50/USERNAME.git
git add -A
git commit -m "Submit project 0"
git push origin master:web50/projects/2020/x/search
When I do git init, I get
Reinitialized existing Git repository in /Users/MYNAME/Desktop/CS50_WebDev/search/.git/
When I do git remote add origin https://github.com/me50/USERNAME.git , I get
fatal: remote origin already exists.
I've been trying to fix this problem for the last 3 hours. Please help me.
The bot grading is very particular: "By way of example, for this project that means that if the grading staff visits https://github.com/me50/USERNAME/blob/web50/projects/2020/x/search/index.html (where USERNAME is your own GitHub username as provided in the form, below) your submission for index.html for this project should be what appears. If it doesn't, reorganize your repository as needed to match this paradigm.:
When I do git init, I get
Reinitialized existing Git repository ...
This is the source of the error. The instructions assume that you do not yet have a Git repository, so that git init
will create one. If you already have a Git repository, git init
mostly does nothing. 1 Hence if your existing Git repository already has a remote named origin
, git remote add origin
fails because it can't add a new origin.
Probably what you should be doing is starting in a new directory that does not have an existing Git repository. (Usually I like to start with a completely empty directory, rather than one populated with some existing files, but their instructions assume you have a directory populated with files, just no .git
hidden sub-directory.)
1 The mostly is here because it still installs any standard hooks from the standard-hook-template directory. You can use this to install particular Git hooks from a particular directory of your choice, using the --template
option. I don't know of anyone who actually does this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.