0

So there are quite a few questions on git in regards to setting up a new repository and adding branches etc, but in my case the extra element of git-lfs has caused quite a bit of trouble. I actually have the answer (something that is working in a desired fashion) at this point, but it comes after many articles and research so to save someone else the hassle I am putting this together. (as a side note if someone has a better answer please chime in and I will happily accept your response.

Here is my scenario:

Repo - A (has all commits and branches) - some developers work here

| Branch A1--- >> more branches with other developers working

Repo - B (has no commits or branches) - some developers will be doing work here

I need to be able to move code fluidly from one to the other and starting out Repo A only has one remote. Oh yes and gitlfs is involved - so most of the walkthroughs as mentioned above do not say what needs to happen next.

When I started this adventure, my initial setup was to clone Repo B and then bring Repo A over into B. That was a disaster, final solution there was just to wipe the repo and start again. After doing some more research I found that a better solution would be to setup from Repo A and add a branch then change remote and upstream. Here are is one of the errors that I ran into along the way:

Currently in the master branch of Repo A when I start issuing these commands:

git remote -v

(this shows what your current remotes are) origin https://something.repoA.git (fetch) origin https://something.repoA.git (push)

The error that I got caught up on was this one:

open C:\somefile: the system cannot find the file specified error: failed to push some refs to 'https://something.repoB.git'

Bob
  • 388
  • 5
  • 19

1 Answers1

0

As mentioned above I was able to solution this into a desired state, however if this isn't following the git methodology - or will break and cause merge conflicts or history issues please share.

Currently in the master branch of Repo A when I start issuing these commands:

git checkout -b repoB-branch (this creates a branch based on the current checked out branch) switched to a new branch 'repoB-branch'

git remote add repoB-branch git@github.com:username/repoB.git

git fetch repoB-branch master

fatal: Couldn't find the remote ref master

git remote -v

origin https://something.repoA.git (fetch)

origin https://something.repoA.git (push)

repoB-branch https://something.repoB.git (fetch)

repoB-branch https://something.repoB.git (push)

git push -u repoB-branch master

open C:\somefile: the system cannot find the file specified error: failed to push some refs to 'https://something.repoB.git'

git lfs install

Updated git hooks Git LFS initialized.

git lfs track

git add .gitattributes

git push -u repoB-branch master

open C:\somefile: the system cannot find the file specified error: failed to push some refs to 'https://something.repoB.git'

git lfs fetch --all
git push -u repoB-branch master
Bob
  • 388
  • 5
  • 19