Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - Same User, Different Machine - Clone?

I'm new to Git and I searched for an answer to this but couldn't quite find what I need.

Basically, I have setup a project on my work computer, added files etc and commited to a GitHub repository. I get all that but once I got home, I wanted to download that same project and change a few files as the same user.

At home, I've set up my user.name and user.email like so:

git config --global user.name "username"
git config --global user.email "email"

What I think I do next is:

git clone url

As I said, I'm the same user just working from a different computer - is there anything special I need to do to make sure Git recognises that I'm the same user?

I'm aware this is probably a silly question but nowhere I've found seems to cover this and I really want to make 100% sure that I'm doing this correctly.

like image 683
0Neji Avatar asked Nov 22 '13 17:11

0Neji


People also ask

Can a clone have different name than the origin?

While the default remote name of " origin " can be changed at clone-time with git clone (man)'s --origin option, it was previously not possible to specify a default value for the name of that remote. Add support for a new clone.

Can I have 2 GitHub accounts?

For most developers, there may be a need to run multiple GitHub accounts on one computer. For instance, you can run an Organization's GitHub account and another one for your personal projects all on the same computer. In this article, you will learn how to use multiple SSH keys for different GitHub accounts.


2 Answers

Anything else? Nope. Configuring Git with the same email address on both machines should do the trick since commits are associated to the committer's email address. You might have a little more work cut out for you if you're using GPG for signing tags, but that isn't in your question.

The other answer's mention of setting up an SSH key on Github isn't required for maintaining identity across machines — but not needing to type in your password will certainly make life easier. You can also use the Git credential helper to cache your Github password.

If you're working on Git projects across multiple machines, you might also want to add Dropbox into your workflow for even more power.

like image 117
justin Avatar answered Oct 06 '22 15:10

justin


That should work just fine. You may need to set up a public SSH key for github, especially if you don't want to have to type in your password every time you push to github.

like image 44
cm2 Avatar answered Oct 06 '22 14:10

cm2