Dustin Sun
Dustin Sun

Reputation: 5532

AWS CodeCommit Unable to create branch using git push

My repo worked well until I moved it to another another account.All branches except master were lost during the migration. Earlier today, I find I am unable to create a new branch using git push origin new-branch

The command returns successful message. But in AWS console the branch is not just there. I can create a new branch in the console so I guess it is not about authorization.

What the command returns:

Counting objects: 56, done.                                                                                                                                                                                        
Delta compression using up to 4 threads.                                                                                                                                                                           
Compressing objects: 100% (28/28), done.                                                                                                                                                                           
Writing objects: 100% (31/31), 12.38 KiB | 0 bytes/s, done.
Total 31 (delta 16), reused 0 (delta 0)
To https://user:[email protected]/v1/repos/myrepo
* [new branch]      new-branch -> new-branchh

Upvotes: 2

Views: 2824

Answers (2)

David Jackson
David Jackson

Reputation: 611

It might be that you have configured the upstream to push to a different branch than you anticipated?

For example, your output shows:

  • [new branch] new-branch -> new-branchh

This means your local branch 'new-branch' was pushed to remote branch 'new-branchh' (two h characters).

You should also verify the user credentials you are using with Git are associated with an identity in the same AWS account you are using to view the console. Additionally, verify that the CodeCommit regional endpoint you are pushing to (us-east-1) is the same region you are viewing in the AWS console (N. Virginia).

Upvotes: 0

Naguib Ihab
Naguib Ihab

Reputation: 4506

So the branching might be happening in your local repo but not getting pushed to the remote repo. Try branching out using these two commands:

  1. git checkout -b mynewbranch

  2. git push --set-upstream origin mynewbranch

Upvotes: 2

Related Questions