jupyterlab / jupyterlab-git

A Git extension for JupyterLab
BSD 3-Clause "New" or "Revised" License
1.45k stars 313 forks source link

Empty AWS CodeCommit repo fails to get upstream branch during push #286

Open jaipreet-s opened 5 years ago

jaipreet-s commented 5 years ago

Steps to repro

Details

On observing the server side logs, I saw the following logs which comes from the get_upstream_branch path

[E 21:47:22.008 NotebookApp] Uncaught exception POST /git/push?1543960041903 (10.0.1.116)
    HTTPServerRequest(protocol='https', host='10.0.46.183:8443', method='POST', uri='/git/push?1543960041903', version='HTTP/1.1', remote_ip='10.0.1.116')
    Traceback (most recent call last):
      File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/tornado/web.py", line 1590, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/jupyterlab_git/handlers.py", line 365, in post
        current_upstream_branch = self.git.get_upstream_branch(current_path, current_local_branch)                                                                                  s/JupyterSystemEnv/lib/python3.6/site-packages/jupyterlab
      File "/home/ec2-user/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/jupenvs/JupyterSystemEnv/share/jupyter/labyterlab_git/git.py", line 589, in get_upstream_branch
        ' '.join(command)
    Exception: Error [fatal: ambiguous argument 'master@{upstream}': unknown revision or pkerath not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'                                        twice to skip confirmation).
    ] occurred while executing [git rev-parse --abbrev-ref master@{upstream}] command to get upstream branch.
[W 21:47:22.058 NotebookApp] Unhandled error   

On git status, I see this state of the local repo, and plain git push works

On branch master
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .ipynb_checkpoints/

nothing added to commit but untracked files present (use "git add" to track)
sh-4.2$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 259 bytes | 259.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git-codecommit.us-west-2.amazonaws.com/v1/repos/AmazonSageMaker-jaipreet-new
 * [new branch]      master -> master
amit1rrr commented 5 years ago

Just confirming that this happens if you clone an empty repository.

Anyway to set upstream for empty repositories? Or better yet, if the extensions can handle upstreams for empty repository?

brichet commented 5 months ago

@jaipreet-s does this problem still exist?

I'm not able to reproduce it with jupyterlab-git 0.50.0.

jtpio commented 2 days ago

Just tried today and it seems like it's possible to push via the Git menu. After pushing the buttons are not greyed out anymore.

We should check why the push and pull buttons are disabled in the first place.