2 Replies
      Latest reply on May 26, 2020 12:17 PM by LazyInstantiation
      LazyInstantiation Level 1 Level 1 (0 points)

        After committing changes, I would like to push them to a repository.  I select the "Source Control" => "Push" command and expect the count of commits which differ from the report to disappear.  They do not. 

         

        I enabled Git trace2 API parameters in my .gitconfig file to try and resolve the problem.  To prove that output is written to the trace log files set up wtih the trace2 API, I enable the Inspectors section, then click on different commits to see the git trace output to the logfiles. 

         

        When I execute 'git push' from the command line, I see the exchange with the remote repository.  If I perform the "Push" command from within Xcode, I don't see any output to the logfiles. 

         

        I then configured Wireshark to capture the exchange between my computer and the repository.  I see the exchange for both the terminal and Xcode environment.

         

        I suspect that Xcode uses the internal /usr/bin/git for some commands, and its own internal code for the "Source Control" menu commands.  This could explain why I see the traces for some Git actions but not others.  

         

        Has anybody encountered a 'push' problem within Xcode and resolved the problem?

        • Re: Xcode git push problems
          john daniel Level 4 Level 4 (700 points)

          Has anybody encountered a 'push' problem within Xcode and resolved the problem?

           

          And resolved the problem? You are setting the bar pretty high there aren't you? Out of pure laziness, I do sometimes still use Xcode to push, but that is getting more and more rare. Xcode is still useful for comparing changes. Just today I found the context menu option that does blame, I think. But I don't trust Xcode for git operations. It takes extra work to avoid Xcode bugs.

          • Re: Xcode git push problems
            LazyInstantiation Level 1 Level 1 (0 points)

            I found the issue that was causing Git 'push' commands from the Xcode's Source Control menu options to fail.  It was due to the url naming convention used in the local repository's config file.  This is located in your project's '.git' folder and titled 'config'.  This file is populated with remote, branch, core and other sections for your project.

             

            In this instance, under the [remote "origin"] section, my url was defined as ssh://user@host:/path/to/project.  The command line Git had no problem with this url.  Xcode however, did not like the scheme component of the url.  So, after dropping the 'ssh://' component, and using user@host:/path/to/project, Xcode pushed changes to the remote repository as expected.

             

            I never determined why Xcode did not like the url.

             

            For those interested in viewing how Xcode uses Git, you can modify your user's '.gitconfig' file with the following:

             

            [trace2]

                    normalTarget = /Users/Lazarus/log_git.normal

             

            This directs output to the log_git.normal file as Xcode uses Git (for non-remote repository commands).  Then 'tail -f log_git.normal' in a separate shell to watch the activity.

             

            The trace2 commands are found in 'man git-config' then searching for 'trace2'.