Clone your own Github project on a different machine

Asked

Viewed 256 times

0

I’m starting studies with Git and Github and I have a question I couldn’t find in the documentation or forums.

  1. I have 2 computers, staff and work.
  2. I started a project on Github with the personal machine using Gitbash.
  3. On the machine I downloaded the project I created on Github using the other machine.
  4. I made some changes to the project and want to update on Github .

In short: I want to download my own Github project on another machine and save the update performed.

Can you help me?

2 answers

1

You have to clone the same repository on both machines

git clone https://github.com/(...).git

And if you are working on your work machine and have made some changes that you would like to get on your other machine, just send them to remote, through the git push.

When you perform git push you send your commits to remote, or is Github in your case.

Remote repositories are versions of your repository hosted on the Internet or on any network. You can have several of them, each of which is usually either read-only or read/write. Collaborating with others involves >managing these remote repositories, pushing(updating) and >Pulling(getting) data to and from when you need to share your >work.

reference

1

Hi, Valdir! All right?

If I understand correctly, you want to work with your project on two machines. That shouldn’t be a problem. Basically it would be more or less that:

Check if you have the git config straight:

user: git config user.name "Seu Nome";

email: git config user.email [email protected]

If you are and do not solve try the following:

//Converter um diretório existente em repositório do github:
cd ~/[caminho de onde está teu projeto no pc]
git init
git add .
git commit -m "V1"
git remote add origin ~/[caminho de onde está teu projeto no pc]
git push origin master

Hence you must save the changes...

git add .
git commit -m "Versao modificada"
git push origin master

On the desktop you need to clone the repository. Let’s say it’s all in a folder called "Projects":

cd ~/Projetos
git clone -o [nome do teu projeto] ~/[caminho de onde está teu projeto nesse pc]
cd [nome do teu projeto]
git remote add origin ~/[caminho de onde está teu projeto nesse pc]

Hence you update the working directory from the central repository:

cd ~/[caminho de onde está teu projeto nesse pc]
git pull origin master

I hope I’ve helped.

Hug!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.