Skip to content

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

@jaipreet-s

Description

@jaipreet-s

Steps to repro

  • Create an empty CodeCommit repo
  • Clone locally
  • Touch a file, stage, push.
  • Push failed with an empty error message

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions