Is it time to get a new Github account? - windows

I got my Github account last year in February and configured it on my Windows XP. Successfully configured user.name and global email account. I switched operating system to Windows 8 and accessed the same Github account online.
I took the Try Git course and other supporting materials to start working with the repositories, but Git Bash keeps coming up with the invalid username and password login error on Bash. Completed the forking and would like to start working on a cloned .git template now, but I can't pass the error message.
I tried changing my username, which solved the error partially. On my local repositories list the newly forked folders are not found, and I'm not seeing any guides on how to use Git Shell on the website.
Any ideas on whether this is just a system setup error or is it time to get a new Github account?

You should check your git config using git config --list. If it differs from what your are using then change it with git config user.name YOUR_USERNAME and git config user.email YOUR_EMAIL. More info here.

What you configure as user.name and user.email is what goes into the author and committer fields of commits you create. It has nothing to do with authentication.

Related

Gitbash changing github account

I was using github account A on gitbash and I wanted to switch to B.
I deleted the credentials for github from control panel for account A and signed with B
When I run git config --list, user.email and user.name matched with account A
than I did:
git config --global user.name "AccountB'sname"
git config --global user.email AccountBemail
When I run git config --list , Now user.email and user.name matches with account B. And when I make a commit, It is seem to be with account B. So it's good.
My first question is: Is it all to do when changing github account on gitbash ?
2- why on my first git config --list run, name and email did not match even tho I updated credentials from control panel
Your GitHub credentials and your Git config are two unrelated things.
When you set user.name and user.email, what you are changing is the metadata that will be used in any commits your create. Creating commits is a local operation on your machine, and does not involved talking to GitHub or any other Git server.
When you want to connect to GitHub using a different account, you did the right thing: change your credentials for GitHub in the Windows Credentials Manager. That will not affect how commits are created on your machine, only how you will authenticate yourself when connecting to GitHub.

Easy way to switch between accounts on git in the terminal on windows?

Is there a quick way to just log out and log back in with a different account on git in cmd on windows?
I tried:
git config --global --unset user.name
git config --global --unset user.mail
git config --global --unset credential.helper
so I understand I should have been logged out with the old_user_name?
Then I used:
git config --global user.name "new_user_name"
git config --global user.email "new_email"
git push origin master
I got a massage:
remote: Permission to new_user_name/new_repo.git denied to old_user_name.
fatal: unable to access 'https://github.com/new_user_name/new_repo.git/': The requested URL returned error: 403
That means I'm still logged in with the old account. What else can I do?
The user.name and user.email settings are not logins, in any way, shape, or form. (The credential.helper setting is useful here, but just unsetting it is probably not right.)
Whenever you make a new commit (by, e.g., running git commit), Git needs to know what user name and email address to put in the new commit. Git gets these by reading user.name and user.email at that time. That's all they're for: to set these in new commits.1
When you run git push, you do (usually2) need to authenticate in order to send your new commits to some other Git repository. Git does not do this authentication. Git relies on other programs to do it. Those other programs include:
Web servers, via https URLs: here, Git has to send a user name and password or PAT or some other secret to the web server. Git gets these from:
the URL, if they're in the URL;
a credential helper, which you may configure: Windows Git comes with a Windows-specific credential helper, macOS Git comes with a macOS-specific credential helper, and so on; or
as a last resort, reading the user name and password from the keyboard.
Generally the right way to do this is with a credential helper. See the gitcredentials documentation and the specific credential helpers available for your particular Git installation. The problem with method #1 is that the password is visible right there in the URL by anyone looking at your computer; the problem with method #3 is obvious.
Unsetting the credential helper gets you the default for your system. This might not be the best thing to do. For Windows systems, see Remove credentials from Git and in particular VonC's answer here.
Secure Shell (SSH): here, Git simply runs the ssh command. Windows systems come with their own ssh command these days, and Git-for-Windows comes with its own ssh command because the older Windows systems either lacked ssh entirely or provided an inadequate version, so on Windows systems, you must make sure that you configure and use the correct ssh (whatever that may be for your installation).
Since you are using an https:// URL, you will need to set up your credential system. If you wish to use ssh:// URLs, set up ssh.
1Note that git rebase works by copying existing commits to new and (supposedly / intended-to-be) improved ones, so this too uses the settings: it's making new commits.
2One can set up a completely open, anonymous network where anyone can push anything at any time, but these are way too easy to abuse, so nobody does this in practice.

Wrong user when pushing to Github from VSCode

I am new to VSCode and Github and I use Windows 10. I have 2 Github accounts, one "Private" and one "Work". I started out with "Private" but I am not using it anymore. I linked the VSCode account to "Work" and verified it has done this correctly.
Now, when I push a file from local to remote, it keeps pushing it with "Private". So I checked how to solve this and changed 2 things:
In Git bash, I typed: git config --global user.name and git config user.name, and found out it said "Private" for both. So I entered: git config --global user.name "Work" and git config user.name "Work", which changed this to "Work" for both
On my laptop, I went to Start -> Control Panel -> User accounts -> Manage Your Credentials -> Windows Credentials and removed the credentials for "Private"
I hoped these 2 actions would solve the issue, but unfortunately it doesn't. Is there anywhere else where I should change something?
I solved the issue with help from this link provided by #Abdul:
I typed git config --list, which showed an overview of the credentials cashed. There I noticed user.email was still using the email address of my "Private" account. So I typed git config --global user.email <my "work" email address> and that solved the issue - when I push now to remote it's done via my "Work" git account
The user.name and user.email have nothing to do with authentication, only commit authorship.
And Windows Credential Manager is only used for HTTPS URLs.
If your remote repository is referenced with an SSH URL, said credential manager would not be involved at all.

how to upload (commit) my first project to git hub from xcode

I started commiting my project to github.
For that I created an account in github with email and password.
Then on the console I did inital stuff:
cd project
git init .
git add .
git commit -s
-> I did not commit (stopped without comment), because I expected to enter a password.
In Xcode I committed one file for testing, but I was supriced why I was not asked for a password.
In the logs I see that it was published with a user, that I don't know : user#users-Mac.local
So I don't know where the file is published now for public !
Then I changed my name and email as follow:
xcrun git config --global user.name 'xxxxx'
xcrun git config --global user.email 'yyyyy'
But still I don't have to provide a password and I guess it is not working properly with my account.
Can anyone help me out ?
Getting code onto GitHub has two main steps:
git commit your changes
git push to GitHub
Nothing's asking you for a password when you commit, because that's still totally local to your machine. Only when you push will you need to authenticate with GitHub.
Check out these guides to help you get started:
Git basics
Set up Git with GitHub

git mac application

So, I Just started to use GitHub, and I downloaded the application. And If I do commit something of to my github it uses my username of my computer, how do I change it to use the username of my github account?
So Question: How do you get the GitHub application (mac) to use your own github account username instead of your computers account username
In the github application, click Github -> Preferences, and verify what your name is set to.
You can also see what name your git repo will use from the command line.
cd /your/git/repo
git config user.name
If you want to change the user name for just that repo...
cd /your/git/repo
git config user.name "joe smoe"
If you want to change your user name for every repo
git config --global user.name "joe smoe"
https://help.github.com/articles/setting-your-username-in-git
Lastly, double check 'how' you are pushing up your commits. You may be using https which behaves differently than ssh. I can't say for sure how http behaves because I always use ssh.

Resources