I cloned a Git repository from my GitHub account to my PC.
I want to work with both my PC and laptop, but with one GitHub account.
When I try to push to or p
Updating your Git configuration file directly (if you do not want to memorize fancy commands):
Open your .git/config
file in your favorite text editor. It will be in the folder that you cloned or in the repository that you performed git init
in. Go into that repository. .git
is a hidden folder, and pressing Ctrl + H should show the hidden folder, (ls -a
in terminal).
Below is a sample of the .git/config
file. Copy and paste these lines and be sure to update those lines with your Git information.
[user]
name = Tux
email = tux@gmail.com
username = happy_feet
[remote "origin"]
url = https://github.com/happy_feet/my_code.git
fetch = +refs/heads/*:refs/remotes/origin/*
Change the URL part with the following format for SSH:
url = git@github.com:happy_feet/my_code.git
(The above formats do not change with various Git remote servers like GitHub or Bitbucket. It's the same if you are using Git for version control):
Note: The SSH way of connecting to a remote Git repository will require you to add your public SSH key to your Git remote server (like GitHub or Bitbucket. Search the settings page for SSH keys).
To know how to generate your SSH keys, refer to: Creating SSH keys