Hello, I just completed the Uploading your project course in the Learning Lab. However, I was able to complete it despite not being able to upload any files to the repository.
I am posting this both as a question and as a possible bug – the bot somehow moved on to the next issue even though I didn’t complete the instructions.
Here are the instructions for uploading from the exercise:
- In your command line, navigate to your project directory. Type git init to initialize the directory as a Git repository.
- Type git remote add origin https://github.com/[current username]/github-upload.git
- Type git add .
- Type git commit -m "initializing repository"
- Type git push -u origin master to push the files you have locally to the remote on GitHub. (You may be asked to log in.)
At step 5, the output is error: failed to push some refs to [url]
hint: …the remote contains work you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes (eg., git pull …) before pushing again. See the note about fast-forwards in ‘git push --help’ for details.
The only files in the online repo not in the local folder was the .gitignore (which cannot be created on Windows). After reading the note mentioned in the hint, I tried using --set-upstream origin master --force, but this failed with the error: GH007: Your push would publish a private email address. I do not want to resolve it by setting my email to be public, but I think this error message is incorrect anyway, as there is no reason the push would require publishing any email address.
EDIT: I configured my global Git email address using the noreply address. Now I get
error: failed to push some refs because the tip of your current branch is behind its remote counterpart. Integrate the remote changes…
UPDATE: I followed the instructions on the Git Handbook, under the heading ‘Example: contribute to an existing repository’. Note: the ‘git add’ step did not work for me, but going to the next command was still possible. Uploading worked as expected using those commands.
I’d still like to figure out why the course instructions didn’t work for me, and why the course bot allowed me to pass without uploading anything, so any thoughts would be welcome. Can I suggest an improvement to the course by using the commands from the Git Handbook?