benmiller314 / cdm2019fall

Code base for Ben Miller's course in Composing Digital Media
https://benmiller314.github.io/cdm2019fall
0 stars 2 forks source link

bug: can't push LFS object to public fork #9

Closed benmiller314 closed 5 years ago

benmiller314 commented 5 years ago

Several students wrote to me today to say they'd gotten an error message: they weren't allowed to push their GIMP .xcf files to GitHub.

error message

Problem! I'd set up the .gitattributes file to designate .xcf files as Git-LFS objects, and now they were blocked, because public forks don't allow LFS objects to be pushed.

But this is also confusing, because we'd been able to use Git-LFS just fine with Audacity. What's up?

benmiller314 commented 5 years ago

It turns out that it's not a blanket prohibition on Git-LFS objects in general; it's just that the owner of the repository has to signal that they want LFS objects first, by including at least one LFS object themselves.

For the soundscape project, I'd included .mp3 files in my .gitattributes setup for LFS, and I'd included the mystery-sound.mp3 file, so everything worked fine.

So I went ahead and added a new .xcf file to the original ("upstream") repository, so hopefully this will just start working again now.

benmiller314 commented 5 years ago

However, if it doesn't work, you may need to pull the changes from that upstream branch. If you're comfortable with command line, there are good instructions on how to do that here: help.github.com/en/articles/merging-an-upstream-repository-into-your-fork.

But if you're not sure what those instructions are doing, and you'd rather not mess around in command line without that understanding, there's also a way to do it with GitHub Desktop. I couldn't find a good visual walkthrough of that process, so I'm making one here.

Merge from Upstream Branch in GitHub Desktop

Open your repo in GitHub Desktop

01-find-your-repo

Pull down the branches menu

02-pull-down-branch-menu

If you see a branch called "upstream/master," you know you're in a forked repo. Don't click on the upstream here, though: you want to be on the destination branch, which is probably just called "master."

03-confirm-upstream-exists

Start the merge.

Once you know you're in the right place, click on the button at the bottom to "choose a branch to merge into master (or whatever your local branch is called).

04-choose-branch-to-merge

Select the upstream branch as the merge source

On the next screen, you can now select the upstream/master to merge into master.

05-merge-upstream-into-local

If there are no conflicts, you'll get right back to your GitHub Desktop homescreen – perhaps with a prompt to push the changes you just merged in.

06-successful-merge

Uh oh! It won't let me merge!

If the changes from the repo you forked (the "upstream") conflict with the changes you've made to your new repo – e.g. if you've written your own README.md file, and the upstream would revert your edits – you'll have to resolve a merge conflict. You'll first encounter this warning at the merge stage:

05-merge-upstream-into-local--with-error

GitHub Desktop will then helpfully offer to open your preferred text editor to fix the merge conflict.

07-resolve-conflict-warning

Option one: conflict avoidance

Depending on the filetype where the error occurs, it may be easier just to

  1. cancel the merge
  2. temporarily remove your new-and-improved local version from your repository
  3. try the merge again using the steps above, without the conflict this time
  4. return the new-and-improved file to the repository
  5. commit that change and carry on with your life.

Option two: fix it with help

But if the change really is in a text-based file, it might be easy enough to pick the versions you want – even going line-by-line. For this, I highly recommend the text editor Atom. One of its neat features is that it has git merge resolution built in. It will highlight the local version (as "our changes") and the version from the merge (as "their changes"), and all you have to do is click a single "Use me" button at the top of the highlighting and Atom takes care of the rest.

08-resolve-merge-with-atom

At that point, you can head back to GitHub Desktop to carry on with the merge:

09-conflicts-resolved

Last step: push

That should bring you back to the home screen, where GitHub Desktop will probably suggest (as in the original, merge-conflict-free scenario) that you push your changes.

And you can get on with your actual editing!

JasmineCT commented 4 years ago

@benmiller314 I had the same issue with the pop up of:

Screen Shot 2020-10-28 at 1 50 33 PM

I followed the solution of merging upstream/master to the master, and it was successful to merge but I still get the pop up of unable to push.

benmiller314 commented 4 years ago

@JasmineCT Do you think it might be the same problem of git-lfs being enabled, but not having any files that use git-lfs in the upstream repository you forked? You might need to contact the owner of that repo, whether on their issue queue or with a pull request.

JasmineCT commented 4 years ago

@benmiller314 it could be that issue. It's actually my repository, but I never created an upstream branch. I'm not sure where it cam from.

benmiller314 commented 4 years ago

Weird. Do you remember forking a repository, possibly even your own? That's the only way to have an "upstream" and "downstream," as far as I know.

You should be able to see the full fork network (including the upstream / root) when you go to https://github.com/JasmineCT/portfolio/network/members (or substitute the actual repo URL for the part before /network/members).

On Thu, Oct 29, 2020 at 8:14 AM Jasmine Carlucci-Tanguay < notifications@github.com> wrote:

@benmiller314 https://github.com/benmiller314 it could be that issue. It's actually my repository, but I never created an upstream branch. I'm not sure where it cam from.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/benmiller314/cdm2019fall/issues/9#issuecomment-718713751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYI3YM6TCOYN3CGSSY7Z3DSNFMBPANCNFSM4I7N3F5A .