GIT & GitHub Errors Fix

Development & UX Researches
3 min readFeb 4, 2021

--

I heard that one of a newbie kept his all code on his personal computer while he was learning and improving his coding skills for a job application. Pushing the codes you write daily will also be a positive sign for your application.

However, learning Git and Github is not easy in some cases. Imagine you cloned the repo, created your own one, and trying to push, it won’t work. There are going to be a bunch of failures. This story will focus on these failures and I will collect and list them here.

Issue: Authentication Failure

D:\User\IdeaProjects\data>git push -u origin — allfatal: Authentication failed for “the git url”

Solution: Control Panel → Credential Manager → Manage Windows Credentials → Choose the entry of the git repository, and Edit the user and password (manipulate on MAC accordingly).

Issue: Could not resolve proxy-git clone

git config — global — unset https.proxyRun the command,
enter the UserName and Password to configure.

Option-2:

For global setting, open the terminal (from anywhere) run the following:
git config — global user.name “your username”
git config — global user.password “your password”
By that, any local git repo that you have on your machine will use that information. You can individually config for each repo by doing:

open the terminal/cmd at the repo folder and run the following:
git config user.name “your username”
git config user.password “your password”

Issue: To exit from the Git editor

Press “i” (i for insert)
write your merge message
Press “ESC” (escape)
write “:wq” (write & quit)
then press enter.

Issue: .gitignore isn’t ignoring itself

After creating a new branch locally, to push it to the remote repo,
Git push — set-upstream origin dev

Problem: .gitignore isn’t ignoring itself

Add the -> *!.gitignore to the gitignore file.
Then run the command -> git rm — cached FILENAME
EX; [git rm — cached .gitignore]

Issue: Push a cloned repo to your own branch

Add the files in your new local repository. This stages them for the first commit.
$ git add .
$ git commit -m “First commit”
$ git remote add origin remote repository URL
$ git remote -v
# Verifies the new remote URL
$ git push -u origin main

The below methods also will help you to re-point your local repo to the remote one:
$git remote set-url origin https://githubCloneLink…
$Git push

$git remote add origin https://githubCloneLink…
Then push normally like so:
$git push -u origin master OR $git push -u origin main

Reset Git Credentials

git config — global user.name “userName”
git config — global user.password “Password” (keep typing even you don’t see the text)

Git Basics

git init — Initialize a local Git repositorygit clone gitLink— Creates a local copy of a remote repositorygit status — Check statusgit add [file-name.txt] — Add a file to the staging areagit add -A — Add all new and changed files to the staging areagit rm -r [file-name.txt] — Remove a file (or folder)git commit -m “[commit message]” — Commit changesgit branch — List branches (the asterisk denotes the current branch)git branch -a — List all branches (local and remote)git branch [branch name] — Create a new branchgit branch -d [branch name] — Delete a branchgit checkout -b [branch name] — Create a new branch and switch to itgit checkout [branch name] — Switch to a branchgit merge [branch name] — Merge a branch into the active branchgit stash — Stash changes in a dirty working directorygit push — Push changes to the remote repositorygit push origin — delete [branch name] — Delete a remote branchgit pull — Update local repository to the newest commitgit remote set-url origin gitRepoLink — Set a repository’s origin branchBONUS: -ls ltra -> type this command to list the hidden files on the terminal/cmd.

--

--

Development & UX Researches

A self-learner in the programming and UX industry. Keep yourself updated in this journey together ;)