Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialwallistsai2
6,476 PointsError 403 in response to git push -u origin master
Hi, I'm getting the following message:
♥ git push -u origin master remote: Permission to OctoWallE/treebook_p.git denied to WallisWT. fatal: unable to access 'https://github.com/OctoWallE/treebook_p.git/': The requested URL returned error: 403
I'm running git version 2.3.2
I've tried a few times and am pretty sure it wasn't a random typo issue.
Thanks in advance for any help on this!
wallistsai2
6,476 PointsMy username on GitHub is OctoWallE
Ryan Duchene
Courses Plus Student 46,022 PointsBecause Git apparently thinks that your username is WallisWT. That's why it won't let you push.
Let me try to figure out a solution for you.
wallistsai2
6,476 Pointsgitconfig is now:
[user] name = Wallis Tsai email = myname@domainname.com
WallisWT github account email is oldemail OctoWallE github account email is currentemail gitconfig email is currentemail (same as OctoWallE github account)
5 Answers
Ryan Duchene
Courses Plus Student 46,022 PointsOkay, try running the following two commands in your terminal, replacing the obvious things:
git config --global user.name "Your Name Here"
git config --global user.email "Your Email Address Here"
Then close the terminal, reopen it, and try running git push -u origin master remote
again.
wallistsai2
6,476 PointsThanks for looking into this -- I'm getting a different error now:
♥ git push -u origin master remote error: src refspec remote does not match any. error: failed to push some refs to 'https://github.com/OctoWallE/treebook_p.git'
After seeing that, I went into my gitconfig file to see if something looked wrong: ♥ subl $HOME/.gitconfig
Interestingly, even though my email & name were updated (name = OctoWallE), there was a portion that said: [github] user: WallisWT
I changed this WallisWT --> OctoWallE
I closed Terminal, reopened and tried: [15:03:10] (master) treebook ♥ git push -u origin master remote: Permission to OctoWallE/treebook_p.git denied to WallisWT. fatal: unable to access 'https://github.com/OctoWallE/treebook_p.git/': The requested URL returned error: 403
I double-checked my $HOME/.gitconfig file, and the switch from WallisWT to OctoWallE was still there...
Ryan Duchene
Courses Plus Student 46,022 PointsIn your project folder, run subl .git/config
from your terminal and see if WallisWT is in that file.
wallistsai2
6,476 PointsThanks, subl .git/config shows
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/OctoWallE/treebook_p.git
fetch = +refs/heads/*:refs/remotes/origin/*
I also checked my bash profile, and the 4 references to WallisWT were all in the context of Users/WallisWT on my mac...I've included the context for these 4 references below, in case that helps:
# Aliases
function desktop {
cd /Users/WallisWT/Desktop/$@
}
function code {
cd /Users/WallisWT/Development/code/$@
}
*******further down in bash_profile**********
complete -o default -o nospace -F _rakecomplete rake
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "/Users/WallisWT/.rvm/scripts/rvm" ]] && source "/Users/WallisWT/.rvm/scripts/rvm" # This loads RVM into a shell session.if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Ryan Duchene
Courses Plus Student 46,022 PointsWhat are the contents of your ~/.gitconfig
file?
wallistsai2
6,476 Pointsgitconfig file is as follow. I put in a not-real email, but everything else is exactly the same. The actual email I use is the same one attached to my github account.
Thanks again for all your efforts to figure out what is going on here
[user]
email = myemail@domainname.com
name = Wallis Tsai
[core]
autocrlf = input
safecrlf = true
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = /Users/WallisWT/.gitignore_global
[alias]
st = status
ci = commit
br = branch
co = checkout
df = diff
lg = log -p
who = shortlog -s --
up = pull
pu = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master"
switch = !legit switch \"$@\"
branches = !legit branches
sprout = !legit sprout \"$@\"
unpublish = !legit unpublish \"$@\"
harvest = !legit harvest \"$@\"
sync = !legit sync \"$@\"
publish = !legit publish \"$@\"
graft = !legit graft \"$@\"
[github]
user = OctoWallE
[color]
ui = true
diff = auto
status = auto
branch = auto
[diff "ruby"]
funcname = ^ *\\(\\(class\\|module\\|def\\) .*\\)
[push]
default = current
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[format]
pretty = %C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset
[filter "hawser"]
clean = git hawser clean %f
smudge = git hawser smudge %f
required = true
Mara Bearcat
Courses Plus Student 2,970 PointsThank you Ryan, this still helped me in 2017!
Ryan Duchene
Courses Plus Student 46,022 PointsGlad I can help! A lot of this is just me learning with you. I haven't really taken the time to learn the ins and outs of Git like I should have, and I'm learning about Git's internals right now as well.
This will be a long shot, but try running this command in your terminal:
mv ~/.gitconfig ~/.gitconfig_old
After that, restart your terminal and run this command, replacing the obvious:
git config --global user.name "Your Real Name Here" && git config --global user.email "Your Email Address Here"
And after that, try pushing to GitHub again. It will almost certainly ask for a username and password.
Let me know if it works!
wallistsai2
6,476 Pointshm, it's still denying access:
♥ git push -u origin master remote: Permission to OctoWallE/treebook_p.git denied to WallisWT. fatal: unable to access 'https://github.com/OctoWallE/treebook_p.git/': The requested URL returned error: 403
I checked on GitHub and I do have an old / dormant account where my username was WallisWT, but I'm not sure why it's still "reading" me as that.
Ryan Duchene
Courses Plus Student 46,022 PointsCan you paste the contents of your ~/.gitconfig
file again? Also, is the email address you're using for your OctoWallE account the same as for your WallisWT account?
Ryan Duchene
Courses Plus Student 46,022 PointsHmm, this has me stumped. Can you try downloading GitHub for Mac and signing in there?
Davenport Kaleb
11,212 PointsHey, I have the exact same problem. Have you found a solution?
Davenport Kaleb
11,212 PointsI figured it out! You have to change your KeyChain account on the mac settings.
Ryan Duchene
Courses Plus Student 46,022 PointsRyan Duchene
Courses Plus Student 46,022 PointsA 403 HTTP error means that you don't have permission to access that repository. What username do you have on GitHub?