• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to Integrate local Git Repo with Remote Git Repo?

 
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I have a project that has not been "Cloned" from a remote Git repo, but it uses Git locally for commits and such, how do I get that project into a (possibly new) remote repo?

Do I first need to create an empty project in the remote repo and do a push from the local project? That idea doesn't seem to jive with how you have to clone the remote repo initially.

I am just not sure of this particular workflow: you have a local Git repo, but you want to integrate it with a remote Git repo like on GitHub or wherever so you can also do push(es).

Thanks in advance,

-mike
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Normally you would create the remote repository, then add the origin, and then push.

For example, if I had created a repository called andrewplay on git.example.com (not a real repository location), I would then run the following commands in my local directory:


 
Mike London
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrew Monkhouse wrote:Normally you would create the remote repository, then add the origin, and then push.

For example, if I had created a repository called andrewplay on git.example.com (not a real repository location), I would then run the following commands in my local directory:




Thanks much. I'm assuming I can do all this from Tower (Git GUI for mac).

Appreciate your reply.

-mike
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used Tower. However they claim: "Easily create, delete and rename branches, tags, and remotes". Given that, it sounds like you should be able to add your remote then push the project.
 
Mike London
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrew Monkhouse wrote:I've never used Tower. However they claim: "Easily create, delete and rename branches, tags, and remotes". Given that, it sounds like you should be able to add your remote then push the project.



Thanks Andrew.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you mean force to two repo be the same version, you can add "-f" to push
 
Mike London
Bartender
Posts: 1971
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Wade Zhang wrote:If you mean force to two repo be the same version, you can add "-f" to push



Wow, a response four years later! Thanks, man.

I still have Tower, but I now just use Git via the IDE. So much easier and only one program to worry about.

Thanks again for your posting.

- mike
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic