Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3878932
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:40:07+00:00 2026-05-19T22:40:07+00:00

Let’s say that I have a desktop pc and a laptop, and sometimes I

  • 0

Let’s say that I have a desktop pc and a laptop,
and sometimes I work on the desktop and sometimes I work on the laptop.

What is the easiest way to move a git repository back and forth?

I want the git repositories to be identical,
so that I can continue where I left of at the other computer.

I would like to make sure that I have the same branches and tags on both of the computers.

Thanks
Johan

Note: I know how to do this with SubVersion, but I’m curious on how this would work with git. If it is easier, I can use a third pc as classical server that the two pc:s can sync against.

Note: Both computers are running Linux.


Update:

So let’s try XANI:s idea with a bare git repo on a server,
and the push command syntax from KingCrunch.
In this example there is two clients and one server.

So let’s create the server part first.

ssh user@server
mkdir -p ~/git_test/workspace
cd ~/git_test/workspace
git --bare init

So then from one of the other computers I try to get a copy of the repo with clone:

git clone user@server:~/git_test/workspace/
Initialized empty Git repository in /home/user/git_test/repo1/workspace/.git/
warning: You appear to have cloned an empty repository.

Then go into that repo and add a file:

cd workspace/
echo "test1" > testfile1.txt
git add testfile1.txt
git commit testfile1.txt -m "Added file testfile1.txt"
git push origin master

Now the server is updated with testfile1.txt.

Anyway, let’s see if we can get this file from the other computer.

mkdir -p ~/git_test/repo2
cd ~/git_test/repo2
git clone user@server:~/git_test/workspace/
cd workspace/
git pull

And now we can see the testfile.

At this point we can edit it with some more content and update the server again.

echo "test2" >> testfile1.txt
git add testfile1.txt
git commit -m "Test2"
git push origin master

Then we go back to the first client and do a git pull to see the updated file.
And now I can move back and forth between the two computers,
and add a third if I like to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:40:08+00:00Added an answer on May 19, 2026 at 10:40 pm

    I think, there are multiple approaches. I will just describe, how I handle this

    I have one netbook as a 24/7 server, that holds multiple git-repositories. From/To there I push and pull changes via SSH. For access from outside I use dyndns.org. It works fine, especially because I have more than two systems, that needs access to some of the repositories.

    Update: A little example.
    Lets say my netbook is called “netbook”. I create a repository there

    $ ssh username@netbook.local
    $ cd ~/git
    $ mkdir newThing
    $ cd newThing
    $ git init --bare
    

    On my desktop I will than create a clone of it. Maybe I will add some files also

    $ git clone username@netbook.local:/home/username/git/newThing
    $ git add .
    $ git commit -m "Initial"
    $ git push origin master
    

    On my portables I will (first) do the same, but for remote access (from outside my LAN), I will also add the external address.

    $ git clone username@netbook.local:/home/username/git/newThing
    $ git remote add externalName username@mydyndns.home-ip.org:/home/username/git/newThing
    $ git pull externalName master
    

    Its just the way git (/git workflows) works. You can add as many remote repositories as you like. It doesnt matters, if two or more refers to the same “physical” repositories. You dont need an own local “server”, you can use any public server, to which you have ssh access. And of course you dont need a public server at all, if you dont need access from outside. The bare repository can also be on the desktop system and you can then create a working-copy-repository within the local filesystem.

    $ mkdir myRepo; cd myRepo
    $ git init --bare
    $ cd /path/to/myProject
    $ git remote add origin /path/to/myRepo
    $ git add .; git commit -m "Initial"; git push origin master
    

    This is the way, how I handle this, and I for me it works quite fine (if not perfect ;))

    Something to read: http://progit.org/
    Really good book.-

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me explain best with an example. Say you have node class that can
Let's say that I have a SQLite database that I create in a separate
Let's say I have two text files that I need to extract data out
Let's say I have multiple requirements for a password. The first is that the
Let's say that I have a date in R and it's formatted as follows.
Let's say you have a method that expects a numerical value as an argument.
Let's say I have a bunch of links that share a click event: <a
Let's say that I have a html form (actually I have an editor -
Let's say that we have an ARGB color: Color argb = Color.FromARGB(127, 69, 12,
Let's say you have a class, with certain properties, and that you tried your

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.