Git Push Error - 401 Unauthorized While Accessing...

If you have an existing folder that you want to push, the instructions on GitLab are as follows


cd existing_folder 

git init git remote add origin https://gitlab.com/username/MyProject.git 

git add . 

git commit -m "Initial commit" 

git push -u origin master


However I was receiving the following error;


error: The requested URL returned error: 401 Unauthorized while accessing https://gitlab.com../...


Changing the code to the following worked;


cd existing_folder

git init git remote add origin https://gitusername@gitlab.com/username/MyProject.git

git add .

git commit -m "Initial commit"

git push -u origin master


You will then be prompted for your GitLab password.


Hope this helps!

Rate this blog entry:
Git Rename Branch Local and Remote Securely
Git - Access denied fatal: Authentication failed ...

Comments

 
No comments yet

Latest Comments

Susan Hermiston Virtual Hosts
October 7, 2015
Wow 747 just blew me away. Sorry not a tech person at all!! But I still love you!! Rock on!!?
Johmny Invisible Mouse Cursor Ubuntu & Synergy
September 2, 2015
Glad I was ble to help!
Kristian Falk Invisible Mouse Cursor Ubuntu & Synergy
September 1, 2015
Thank you for this! Had the exact same problem. I almost went crazy.