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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With