I'm trying to push to my github account from Intellij. Everything is working correctly. However, when I go from the browser into Github, instead of my github username the name "DontNeedGithubAccount" is being shown for the commits. I'm surprised that Google only has a few entries when searching for "DontNeedGithubAccount" but none of them are even remotely helpful.
Thanks to Ped7g, I figured it out: In your git config (.git/Config), you need to add
[user]
name = github_username
email = github_email#example.com
You can also achieve this by doing (use --local for current or --global for all repos)
git config --local user.name github_username
git config --local user.email github_email#example.com
The username must match the one on Github. If you additionally provide the same email you can click on your username and get to your account.
Related
in Visual studio code
i spent a lot more time for this, I'm trying push my deleted project that is coming from 1st account github into an existing repository in new another account, but I'm getting error like this :
$ git push -u origin main
remote: Permission to username/project_name.git denied to first_account_username.
fatal: unable to access 'https://github.com/user_name/project_name.git/': The requested URL returned error: 403
i tried those command line for push an existing repository in new account, please let me know what'd i miss ?
git remote add origin https://github.com/user_name/project_name.git
git branch -M main
git push -u origin main
Git obviously tries to push code to your new repository using your old username. Add you new username explicitly to the URL:
git remote set-url origin https://user_name#github.com/user_name/project_name.git
Or use the SSH syntax:
git remote set-url origin user_name#github.com:user_name/project_name.git
Question :
$ git push -u origin main
remote: Permission to username/project_name.git denied to another_username
fatal: unable to access 'https://github.com/user_name/project_name.git/': The requested URL returned error: 403
Answer :
Above the Setting icon in visual studio code there will be a Account Sign in logo icon, click and check it is login with another account or not ?
If it is log in with another Account you will be get the same error continuously... So,
The solution is : You should sign out the other Account in the visual studio and then try in visual studio code terminal following code given below...
$ git push
Then it will ask username and password
you should enter the correct details and it will work perfectly.
Just see the same problem and here is my solution:
Before we generate the token. We need to enable some elements of "select scopes in github settings as show below.
I just select several elements and generate key. Therefore I can push the code after fill username and password(generated key).
Check what configuration helper you do have: it might have cached the wrong credentials (from the old users).
git config --global credential helper
Adjust you PATH to use said credential helper.
If you are on Windows, in a CMD, set a simplified PATH like:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set "GH=%ProgramFiles%\Git"
set "PATH=%GH%\bin;%GH%\cmd;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%"
Then type in the same CMD:
printf "Host=bitbucket.org\nprotocol=https\nusername=old_username" | git credential-manager-core erase
Replace:
manager-core by your actual credential helper, as returned by git config --global credential helper
old_username by the old username GitHub account
Then try again.
First check your credentials:
git config --global user.name
git config --global user.email
Then change with:
git config --global user.name "email"
git config --global user.email "email#email.com"
If you set another credential before, will have problem
use git config credential.username "username"
Whenever I try to commit a file to github i get the following error:
vanes#vanessaddiniz MINGW64 ~/HTML-CSS-and-JS---coursera/site (master)
$ git commit -m "Homepage"
*** Please tell me who you are.
Run
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'vanes#vanessaddiniz.(none)')
This is the frst time I try to do this. I've just started a course on coursera and I did everything exactly as done in the video and everythig was going fine until now. How do i fix this? Anyone who can help me, thanks in advance!
P.S: I'm using Windows.
Git always requires an identification while making a commit to a repository. The identification it uses is either your name or email address. This will be used to show commits which belong to users in Git history. The above output already shows you what you need to do. Run the below commands with your name and email address filled.
git config --global user.email "Your email"
git config --global user.name "Your Name"
After this you should be able to commit to git.
If I committed to github with a wrong local credentials (username and password), will it be possible to change the committer name on github? This issue can happen if you have two git accounts! By the way I'n not asking how to reconfigure your local git account.
1- configure your new username and email with
change username: git config username.user <username>
change email: git config username.email <email>
2- run this command git commit --amend -C HEAD --reset-author
3- run this command git push --force
This will change the other in the last commit.
You can change the last commit locally with
git commit --amend --author="Author Name <email#address.com>"
Then do a
git push --force
This will force the authored commit over the top of the old one.
In my case, I have two GitHub accounts (A and B). I had created a repository using A and in local while configuring git,used email id of B account. So whenever I was pushing the code from my local, git was inferring the account B as author. So even though, I had used credentials of Account A, it was still showing author B for all commits done using local machine.
Fix
Configured email in local for Account A and issue got resolved. Further, all commits were showing correct author as A.
For commits to be linked to your Github account, your email or username in your local git configuration should match the one you have on Github.
Check your current Git configuration:
git config --global --list
Update your email or your username as the same value in your Github account:
git config --global user.email "xyz#gmail.com"
git config --global user.name XYZ
git config --global user.username xyz
(Optional) If you want to change previous commits to reflect your new email/username. Be careful, though, if the repository have a multi-user commits, this will change all commits to have the same new author.
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Newname'; GIT_AUTHOR_EMAIL='new#email'; GIT_COMMITTER_NAME='Newname'; GIT_COMMITTER_EMAIL='new#email';" HEAD
I'm trying to push some of my projects to my github account but when i try it wont let me. I was able to push just a couple of days ago and now I cant.
I tried
running
cd existing_git_repo
git remote add origin https://github.com/Ommy/MapTool.git
git push -u origin master
but on git bash it asks for
Username for 'https://github.com':
I try my username/password which doesn't work.
I tried running
git config --global user.name "Fasih Awan"
git config --global user.email *********#gmail.com
but even with that it still asks for the username/password. I created the repository on github before pushing but it still does this. What am I doing wrong?
If you are using HTTP for the remote repository you will still need to type your username and password. If you want to use SSH keys, use the SSH protocol for the remote repository. There is a guide here on how to configure SSH keys.
Either use password caching or SSH. It's all nicely explained here: https://help.github.com/articles/set-up-git
Make sure that you have uploaded your public key to github. The only thing you should be asked for is a password for you public key, not a username.
I have created a repository on github named pygame. Created a clone and added files and commited.but when I attempt to push I receive the following error:
git push -u origin master
error: The requested URL returned error: 403 while accessing https://github.com/amalapk/pygame/info/refs
fatal: HTTP request failed
I can ssh to git#github.com and receive the notice that I logged in successfully, but can't push to my repository.
I recently experienced this problem when setting up a new clone of my github project.
You need to include your username in the URL to your project, in the form
https://user#github.com/project/...
For example, the URL provided for my test github is this:
https://github.com/jdblair/test.git
If I add my username to it, like this, then I'm able to push and pull from github with no problem:
https://jdblair#github.com/jdblair/test.git
It is easiest to use the URL that contains the username starting from when you clone a project.
You can change the URL for an existing project like this:
git remote set-url origin https://user#github.com/project/foo/bar.git
You can use the ssh authentication instead if you want, but that's a separate setup process.
Github now is asking us to use git 1.7.10 or later:
https://help.github.com/articles/error-the-requested-url-returned-error-403
The GitHub Remote page mentions the read/write addresses for a repo:
Make sure your clone address is like:
https://github.com/username/yourRepo.git
And that you have defined:
git config --global user.name "Firstname Lastname"
git config --global user.email "your_email#youremail.com"
Should you use a git address (without ssh), you would also need:
git config --global github.user username
git config --global github.token 0123456789yourf0123456789token # no longer needed
(with your token coming from “Account Settings” > Click “Account Admin.”)
Update 2013: you still can generate a token (see "Creating an access token for command-line use"), but you would use it as a password for https url.
Actually, if you activate the 2FA (two-factor authentication) mechanism on GitHub, you will need a token for your https url (because your regular password would trigger the second-step verification).
See "Configure Git clients, like GitHub for Windows, to not ask for authentication"
See more at "Which remote URL should I use?".
It's all in the remote.
Change your current remote from https://github.com/amalapk/pygame.git to git#github.com:amalapk/pygame.git and enjoy.
To do this... (assuming your current remote is called origin)
git remote set-url origin git#github.com:amalapk/pygame.git
In my case getting rid of such error message was resolved this way:
Person was simply added to github repository as a colaborator.
Thats it - error vanished magically.
Committing to github from server this is what worked for me in the terminal or git bash
To create a remote to github.com try:
git remote add origin https://put your username here#github.com/put your git username here/put your repository name here
To change the remote just do:
git remote set-url origin https://put your username here#github.com/put your git username here/the name of your repository here
Please follow the instructions on http://help.github.com/create-a-repo/
You have cloned your repository with the public read only url.
RTFM