Win a copy of Head First Go this week in the Go forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

How to Integrate local Git Repo with Remote Git Repo?  RSS feed

 
Bartender
Posts: 1649
17
  • Mark post as helpful
  • send pies
  • 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: 12197
279
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 1649
17
  • Mark post as helpful
  • send pies
  • 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: 12197
279
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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: 1649
17
  • Mark post as helpful
  • send pies
  • 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
  • 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: 1649
17
  • Mark post as helpful
  • send pies
  • 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
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!