Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Clone from public repository and push to private repository

I have cloned a public repository from github, made some modifications and now I want to push them to a private repo. The steps I took are shown below:

$ git clone -b dev https://github.com/public_repo
$ cd public_repo
## modify files
$ git add .
$ git status
On branch dev
Your branch is up to date with 'origin/dev'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    new file:   ...
    modified:   ...
    modified:   ...
    ...
$ git commit -m "Now supports new features"
[dev 5f98577c] Now supports Chiplet
 68 files changed, 2855 insertions(+), 1910 deletions(-)
 create mode 100644 ....
$ git remote add private https://private_domain
$ git push private dev
Username for ...
Password for ...
To https://private_domain
 ! [rejected]          dev -> dev (fetch first)
error: failed to push some refs to 'https://private_domain'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Note that the private repository is also on dev branch. How can I fix that?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

according to error : you have different code on the private repo dev branch and you’re trying to push some other changes without taking pull . please try to take pull before push

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading