-1

New to git. I cloned a repo to local, create a branch on the local, changed and add some files, committed the change, and try to pushed it back to the remote using the following sequence of commands and got errors. Could someone point out what the reason that caused the error?

bash-4.4$ cd /home/abc/M3-release4checkin
bash-4.4$ git clone https://bitbucket.agile.com/scm/proj1/repo1.git
bash-4.4$ cd repo1/frontend
bash-4.4$ pwd
/home/abc/M3-release4checkin/repo1/frontend

bash-4.4$ git status
On branch develop
Your branch is up to date with 'origin/develop'.

nothing to commit, working tree clean

bash-4.4$ git checkout -b M3-release-frontend
Switched to a new branch 'M3-release-frontend'

bash-4.4$ cp -r ../../{security,utils,sample_responses,sample_trades,sa_trade_archive,sa_trade_data} .

bash-4.4$ git add --all

bash-4.4$ git commit -m "CHG#-1625: Milestone3 release (frontend)"
[M3-release-frontend d771fb7] CHG#-1625: Milestone3 release (frontend)
 Committer: Joe Doe <joedoe@localhost.localdomain>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 25 files changed, 5111 insertions(+), 143 deletions(-)
 create mode 100755 frontend/common/avsc_lib.py
...


bash-4.4$ git push --set-upstream origin/develop M3-release-frontend
fatal: 'origin/develop' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I was added as one of the "Admin" of the Repository (BitBucket).

techie11
  • 1,243
  • 15
  • 30
  • 1
    What do you intend to do here? What you told git was to push local `M3-release-frontend` branch to branch `M3-release-frontend` of the remote called `origin/develop`. Maybe you just want `origin`, as in `git push -u origin M3-release-frontend`? Or maybe you want to push local branch `M3-release-frontend` to remote branch `develop`? Then you'd write `git push -u origin M3-release-frontend:develop`. – CherryDT Aug 22 '20 at 21:47
  • 2
    Does this answer your question? [Git push: "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."](https://stackoverflow.com/questions/32238616/git-push-fatal-origin-does-not-appear-to-be-a-git-repository-fatal-could-n) – SwissCodeMen Aug 22 '20 at 21:50
  • @CherryDT: Thanks. I think your correct. – techie11 Aug 22 '20 at 22:19

1 Answers1

-2

Below is what I did:

  1. I created the branch M3-release-frontend on the remote repository.
  2. I ran git push --set-upstream origin M3-release-frontend
techie11
  • 1,243
  • 15
  • 30
  • 1
    That doesn't sound right, because it _does_ create the remote branch when you push. – CherryDT Aug 22 '20 at 22:23
  • But that's what I did. the remote is BitBucket which is Git. – techie11 Aug 22 '20 at 22:43
  • 1
    I'm pretty sure you also fixed the remote name because `origin/develop` will still be a bad remote. The first argument is a remote and not a ref. – CherryDT Aug 22 '20 at 22:44
  • no. that's the only thing I did. our default branch is always develop – techie11 Aug 23 '20 at 14:19
  • Yes but as I said this argument is a _remote_ and not a _ref_. `origin/develop` would be a _ref_ (the branch `develop` on remote `origin`), but only `origin` alone (not `origin/develop`) would work as remote here! So `git push -u origin/something ...` can never work, only `git push -u origin ...` can. – CherryDT Aug 23 '20 at 14:57
  • (Also note that once you did `git push -u ...` _once_, a simple `git push` will work afterwards since you already set your upstream...) – CherryDT Aug 23 '20 at 14:58
  • @CherryDT: I checked my command history, you're right. no "/develop". – techie11 Aug 24 '20 at 22:21