Announcement

Collapse
No announcement yet.

all of a sudden my remote and local repos are considered out of sync

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • all of a sudden my remote and local repos are considered out of sync

    Hi I was having some luck with GIT between 2 cloned locals (1 for ssis on one server, the other for powershell on another server) and 1 remote repo (Our Dept) with a test and master branch each having these paths 1) Powershell/Key Metrics and 2) SSIS/Key Metrics . There were about 8 files in my ssis vs project file when I last successfully committed and pushed a file after copying it to the local repo.

    After adding my 4th ssis file I tried the same commit etc (copy changed file to local repo followed by git commit -a -m "something" in the team explorer command box under vs followed by choosing "commit all and push" from the vs drop down in team explorer) and got the error below . Eventually I just uploaded items to the remote repo thinking at least I'll know things are versioned. and wondering why I am even bothering with a local repo.

    Bottom line, I'm stuck with this error which I'd like to understand and fix and avoid in the future. Its possible I left crucial details out of the explanation like how I deleted placeholders (there because git couldnt create empty folders) along the way and didn't consider till later that solution files etc change too.

    Cant git tell you exactly whats bothering it so you can avoid costly file by file compares or whatever else is in store for me now, especially if you want to learn from your mistakes? I don't believe anybody else is adding items to the remote repo.

    should I just clone everything all over after perhaps deleting both local repos? I see the hint (git pull) in the error message but honestly don't know from where that kind of command can be issued nor how the context for the target local repo would be set when issuing that command.

    Opening repositories:
    C:\Users\myuser\Source\Repos\Our Dept
    Commit e5f30bc1 created locally in repository C:\Users\myuser\Source\Repos\Our Dept
    Pushing Test
    Error: failed to push some refs to 'http://atfsserver:8080/xxx/yyyyyyyyyyyyyyyyy/develop/_git/Our%20Dept'
    Error: hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.

    Error encountered while pushing to the remote repository: rejected Updates were rejected because the remote contains work that 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 before pushing again.







  • #2
    If you're using 2 client clones of the same git repo and modifying each then you are going to need to coordinate the updates from/to each. Something like:

    1. clone repoA first
    2. clone repoA second
    3. first: add file, commit, push
    4. second: pull (this gets the added file)
    5. second: add file, commit, push
    6. first: pull (this gets the 2nd added file)

    And so on and so forth. You can either do this manually OR you can wait for the failure you see above and then do the "pull" as it states in the error message.

    Comment


    • #3
      Thx Doug. If I have been relying only on the browser, vs and file explorer for everything so far, from where can I issue that pull command? I haven't installed git and am hoping that I don't need to.

      Comment


      • #4
        I'm not a Windows developer so don't have access. I would expect any integration with Git to include a "pull" subcommand somewhere/somehow. For VS it's likely encapsulated it within some "update from repository" feature (or something like that).

        Comment

        Working...
        X