omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Broken pipe error using Stash's git push (both http&https)

    Pythonista
    git error stash
    2
    13
    11339
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SimCityWok
      SimCityWok last edited by

      StaSh v0.6.13
      Tip: Send a running command to background by pressing the CZ button (Ctrl-Z on external keyboard)
      [~/Documents]$ cd alphabear-solver/
      [alphabear-solver]$ git fetch http://github.com/wizardofozzie/alphabear-solver.git
      Starting fetch, this could take a while
      stash: <class 'dulwich.errors.HangupException'>: The remote server unexpectedly closed the connection.
      
      [alphabear-solver]$ git fetch http://github.com/wizardofozzie/alphabear-solver.git
      Starting fetch, this could take a while
      stash: <class 'dulwich.errors.HangupException'>: The remote server unexpectedly closed the connection.
      
      [alphabear-solver]$ git fetch http://github.com/wizardofozzie/alphabear-solver.git
      Starting fetch, this could take a while
      stash: <class 'dulwich.errors.HangupException'>: The remote server unexpectedly closed the connection.
      
      [alphabear-solver]$ git fetch https://github.com/wizardofozzie/alphabear-solver.git
      Starting fetch, this could take a while
      Counting objects: 3, done.
      Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
      Fetch successful.  Importing refs
      imported refs/remotes/origin/master a650a1a9b804dde858f74928fc8e615a97e2f5a4
      Checking for deleted remote refs
      Fetch complete
      [alphabear-solver]$ git merge
      ______________________________
      stash: <type 'exceptions.TypeError'>: object of type 'NoneType' has no len()
      
      [alphabear-solver]$ git merge -h
      ______________________________
      usage: git merge' [--msg <msg>] [<commit>]
          git merge --abort
      
          
          merges <commit> into HEAD, or remote tracking branch if commit not specified.
          <commit> can be a local or remote ref, or an existing commit sha.
      
          merge will handle unambiguous conflicts between head and other 
          merge head, and will insert conflict markers if conflicts cannot be resolved.  
          note that the strategy used will prefer changes in the local head.  
          for instance, if HEAD deleted a section, while MERGE_HEAD modified the same 
          action, the section will be deleted from the final without indicating a conflict.
            
          be sure to commit any local changes before running merge, as files in working tree (i.e on disk) are changed, and checked in, which will probably overwrite any local uncomitted changes.
          
          note merge will not actually commit anything.  run git commit to commit a successful merge.
      
          
          --abort will remove the MERGE_HEAD and MERGE_MSG files, and will reset staging area, but wont affect files on disk.  use git reset --hard or git checkout if this is desired.
          
      
      positional arguments:
        commit      commit sha, local branch, or remote branch name to merge from
      
      optional arguments:
        -h, --help  show this help message and exit
        --msg MSG   commit message to store
        --abort     abort in progress merge attempt
      [alphabear-solver]$ git merge HEAD
      ______________________________
      Fast forwarding master to ecb4a1958ef8b1e288151822ff087f3f64894745
      [alphabear-solver]$ git commit
      Commit Message: 1
      46c9d246c69a3506ec3336357e6f9baea52caf2f
      [alphabear-solver]$ git push 
      Attempting to push to: https://github.com/wizardofozzie/alphabear-solver.git, branch: refs/heads/master
      stash: <class 'urllib2.URLError'>: <urlopen error [Errno 32] Broken pipe>
      
      [alphabear-solver]$ git fetch https://github.com/wizardofozzie/alphabear-solver.git
      Starting fetch, this could take a while
      Fetch successful.  Importing refs
      imported refs/remotes/origin/master a650a1a9b804dde858f74928fc8e615a97e2f5a4
      Checking for deleted remote refs
      Fetch complete
      [alphabear-solver]$ git branch newb origin/master
      [alphabear-solver]$ git reset newb --soft
      updating HEAD to newb
      [alphabear-solver]$ git commit
      Commit Message: 2
      71e91a769320587655bae120454d7fce88ee367b
      [alphabear-solver]$ git push
      Attempting to push to: https://github.com/wizardofozzie/alphabear-solver.git, branch: refs/heads/newb
      stash: <class 'urllib2.URLError'>: <urlopen error [Errno 32] Broken pipe>
      
      [alphabear-solver]$ git remote sshorigin ssh://git@github.com/wizardofozzie/alphabear-solver.git
      [alphabear-solver]$ ssh_keygen
      stash: ssh_keygen: command not found
      
      [alphabear-solver]$ 
      
      1 Reply Last reply Reply Quote 0
      • SimCityWok
        SimCityWok last edited by

        So, 1 & 2 don't work as I posted above, @JonB
        I really appreciate the help.

        Let me rephrase the problem: if I delete the GitHub repo, how can I push my folder to GitHub?

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          Sorry, i was wrong about a few of the commands:

          git fetch origin ( although fetch claims to accept a url, it really wants a remote name)
          git merge origin/master ( the argument is required, apparantly)

          For keygen, sorry, should be:
          ssh-keygen -trsa -b2048 creates a rsa key.

          pbcopy ~/.ssh/id_rsa.pub copies it to the clipboard. You then go to github settings/ssh keys, and click the create new key button, and paste it in with a title of your choice.
          I am updating the gh command to easily add keys without this extra step.

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by JonB

            just to be clear: you have commits locally, but none in github?

            Delete the github repo, then create it without the auto option (bare repo).

            As an example:

            [~/Documents]$ mkdir example
            [~/Documents]$ cd example
            [example]$ git init .
            [example]$ echo hello world > Readme.md
            [example]$ git add Readme.md 
            Adding Readme.md
            [example]$ git commit
            Commit Message: First commit
            Author Name: jb
            Save this setting? [y/n]y
            Author Email: jb
            Save this setting? [y/n]y
            f065a0f14eaaa9777ea250ab5b9e3a2226ea2991
            [example]$ gh create example -i
            Created https://github.com/jsbain/example
            [example]$ git remote origin https://github.com/jsbain/example.git
            [example]$ git push
            
            1 Reply Last reply Reply Quote 1
            • SimCityWok
              SimCityWok last edited by SimCityWok

              [~/Documents]$ cd alphabear-solver/
              [alphabear-solver]$ git init .
              stash: <type 'exceptions.OSError'>: [Errno 17] File exists: './.git'
              
              [alphabear-solver]$ ls -h
              usage: ls.py [-h] [-1] [-a] [-l] [files [files ...]]
              
              positional arguments:
                files           files to be listed
              
              optional arguments:
                -h, --help      show this help message and exit
                -1, --one-line  List one file per line
                -a, --all       do not ignore entries starting with .
                -l, --long      use a long listing format
              [alphabear-solver]$ ls -1a
              .git
              README.md
              ab.py
              dictionary.txt
              hashdict.py
              map.json
              solver.py
              [alphabear-solver]$ rm .git
              .git: is a directory
              [alphabear-solver]$ rm -r .git
              [alphabear-solver]$ git init .
              [alphabear-solver]$ git add *
              Adding README.md
              Adding ab.py
              Adding dictionary.txt
              Adding hashdict.py
              Adding map.json
              Adding solver.py
              [alphabear-solver]$ git commit
              Commit Message: bare Pythonista commit
              Author Name: wizardofozzie
              Save this setting? [y/n]y
              Author Email: djsim4242@gmail.com
              Save this setting? [y/n]y
              628238a51a09ccbff9d389e2a27cd340d4ffe640
              [alphabear-solver]$ gh create alphabear-solver -i
              Created https://github.com/wizardofozzie/alphabear-solver
              [alphabear-solver]$ git remote origin https://github.com/wizardofozzie/alphabear-solver.git
              [alphabear-solver]$ git push
              Attempting to push to: https://github.com/wizardofozzie/alphabear-solver.git, branch: refs/heads/master
              stash: <class 'urllib2.URLError'>: <urlopen error [Errno 32] Broken pipe>
              
              [alphabear-solver]$ 
              

              Same issue

              1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by JonB

                hmm, strange. i followed your example and it worked.
                Can you check your dulwich version?

                import dulwich
                print(dulwich.__version__)
                

                Also, go ahead and update stash:
                selfupdate dev
                and force quit pythonista, and restart it.

                run gh create_key stash to create a ssh key and link it with your github account.

                Then,
                git remote origin ssh://git@github.com/wizardofozzie/alphabear-solver.git
                and then try git push

                This may be a stupid question, but is your user and password stored corrctly?

                import keychain
                print([s for s in keychain.get_services() if s[0]=='stash.git.github.com'][0])
                print(keychain.get_password(*[s for s in keychain.get_services() if s[0]=='stash.git.github.com'][0]))
                

                This should be exactly your github login info.

                1 Reply Last reply Reply Quote 0
                • SimCityWok
                  SimCityWok last edited by

                  Dulwich version (0,12,2)

                  Keychain checks out.

                  gh create_key stash

                  [alphabear-solver]$ gh create_key stash
                  stash: <class 'github.GithubException.GithubException'>: 422 {u'documentation_url': u'https://developer.github.com/v3/users/keys/#create-a-public-key', u'message': u'Validation Failed', u'errors': [{u'field': u'key', u'message': u'key is already in use', u'code': u'custom', u'resource': u'PublicKey'}]}
                  
                  1 Reply Last reply Reply Quote 0
                  • JonB
                    JonB last edited by

                    sounds like you already set up ssh keys. so you should be able to set up the remote url using ssh.

                    SimCityWok 1 Reply Last reply Reply Quote 1
                    • SimCityWok
                      SimCityWok @JonB last edited by SimCityWok

                      @JonB said:

                      sounds like you already set up ssh keys. so you should be able to set up the remote url using ssh.

                      Ok, I appreciate it.
                      Happy to work ssh on stash out myself, but can you tell me where to start?
                      I appreciate all your help

                      EDIT: Dulwich error on SSH

                      [alphabear-solver]$ git remote origin ssh://git@github.com/wizardofozzie/alphabear-solver.git
                      [alphabear-solver]$ git push
                      Attempting to push to: ssh://git@github.com/wizardofozzie/alphabear-solver.git, branch: refs/heads/master
                      
                      [alphabear-solver]$ git push
                      Attempting to push to: ssh://git@github.com/wizardofozzie/alphabear-solver.git, branch: refs/heads/master
                      stash: <class 'dulwich.errors.HangupException'>: The remote server unexpectedly closed the connection.
                      
                      [alphabear-solver]$ ```
                      1 Reply Last reply Reply Quote 0
                      • JonB
                        JonB last edited by

                        you seem to have a real iffy connection ( your earlier entry had a bunch of those hangup errors, followed by success). I think that literally meant that your connection was dropped. Just try git push a few times until you get something other than this error.

                        Are you on wifi or wireless? Or dial up?

                        I am going to write a ping command for stash tonight, and maybe we can test your connection. I am not sure, but it is likely that both errors could be caused by your connection literally dropping out.

                        1 Reply Last reply Reply Quote 1
                        • SimCityWok
                          SimCityWok last edited by

                          I am on Wifi swapping to 4G when it fails (in pasted log)

                          As I said in Slack, updating dulwich as per your recommendation, seems to have done the trick.

                          There was an error saying something about an error renaming to dulwich.old but restarting worked

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Powered by NodeBB Forums | Contributors