Cannot Push to My Github Private Repository

Git pushing to a private repo

Let us say 'yourWebApp' is the folder you have your local web app. Change it to the directory

cd 'yourWebApp'

Init git in the folder

git init

Now add your github url as a remote

git remote add origin git://github.com/somename/Web-App.git

Here origin is the short name for your url

Now pull the read me file from the github repo

 git pull origin master

Now push your web app to the github repository

git push origin master

Here it is assumed that you are in your master, the default branch

Here pulling your readme files is necessary to merge the readme file with your local work. If your github repository is empty, you can skip the pull and directly push to your github repository.

On the other hand, if you want to use clone, there is no need to init as clone automatically sets up git in the directory. clone also sets your remote git url. In that case, your workflow should be

 git clone https://github.com/path/to/your/repo
make some changes
git add your changes
git commit your changes
git push

Unable to push to github private repo

I was using iTerm and when I switched to the default Mac OS terminal it worked fine. Very strange. Thank you so much everyone for your kind help. Really appreciate it.

I created a private repo but I can't push to it from the terminal

You need to specify the protocol, like https:// or git://. Without the protocol, the URL refers to a file on your computer, which probably doesn't exist.

So for example,

git remote add origin https://github.com/my-user-name/XXXXXXX.git

Cannot push to my github private repository

Try instead the scp syntax, to make sure your ~/.ssh/config file is used:

git remote set-url origin github:<username>/<repo>

Then try and push again.


Git itself uses an OpenSSH version (at least the one packages with Git for Windows)

> ssh -V
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017

As explained in "Why doesn't the ssh command follow RFC on URI?", there is a difference between:

ssh://[user@]host.xz[:port]/path/to/repo.git
vs.
user@host.xz:/path/to/repo.git

Only the latter syntax user@host.xz: uses the ssh config file.

When SSH was originally developed, it was developed as a more secure, drop-in replacement for the earlier RSH/rlogin suite of tools.

See "History of the SSH protocol".

OpenSSH (1999) predates URI (finalized in RFC 3986, published in January 2005)

If the host portion was allowed to be on the form host:port, this would create a potential ambiguity: does jdoe@host.example.com:2222 refer to ~jdoe/2222 on host.example.com when connecting on the standard port, or does it refer to no file at all (or worse, ~jdoe) on host.example.com when connecting over port 2222?

Unable to Git clone, pull or push private repository of our company on remote Linux server

The issue fixed itself. After the weekend, when I came back to work and tried to Git sync and it asked for both a username and password (Git token in my case), the issue no longer existed.

But I have no idea why issue existed in the first place.



Related Topics



Leave a reply



Submit