Auto push to github without username and password - github

after much messing around I have followed this tutorial on using a cmd prompt to push up to git hub
http://readwrite.com/2013/10/02/github-for-beginners-part-2
However I have had to do a few things differently. Generating and adding the public key in GitHub went fine, however, adding the private key on my local machine has been a real pain.
I finally added it by opening a cmd prompt as administrator. then going to the directory where github was installed I then rand the following cmds to install the private key
bash
eval $(ssh-agent)
cd to-directory-where-private-.ssh-file-was-located
ssh-add .ssh
Identity added: .ssh (.ssh)
Prior to that I had numerous errors. However, when I run this from a batch file
cd c:/LocalDevelopment/PhoneGap/PfpMetrol
git init
git status
git add PhonegapData.js
git commit -m "Add PhonegapData.js"
git remote -v
git push
pause
it is still asking me for a username and password.

Related

Upload file by git lfs correctly

I tried to upload large file ( 240mb ) to github by lfs by using
- git lfs install
- git init
- git remote add origin "my repo url"
- git lfs track "*.weights"
- git add yolov3.weights
- git commit -m "test"
- git push -u origin master
after uploaded i found the file content
versionversion https://git-lfs.github.com/spec/v1
oid sha256:c49c28814dc8bcd2c48aac1c3e41c92a183cf9b282f6ca4c05f3d99393137952
size 246305388
And not working but the size still 240 mb
How to upload the file right or what is the wrong?
Did you try pushing the code using this command ?
git push origin <branch name> --force
HTTPS protocol can sometimes be unreliable when it comes to pushing large files . It may break unexpectedly
why dont you try pushing the code via SSH method ?
Run these commands below ::
ssh-keygen -t rsa -b 4096 -C "<email id>"
notepad ~/.ssh/<required key>.pub
// paste this public key into your github account
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/<required_key>.pub
You can learn more about the ssh protocol in this article

Start ssh-agent when windows boots along with ssh passphrase

I have a private Github repo, and I generated the SSH keys using windows.
I am trying to launch ssh-agent when my windows server starts, I can have the following command..
start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login -i
but the problem with this is...I would need to enter the passphrase for my SSH key everytime i reboot.
I am working with a github repo, where whenever we commit a change then it triggers the GIT PULL on the server (using webhooks).
Anyway I can automate this?
You could make sure your .profile (called by sh --login -i) includes a call to ssh-agent with a file:
cat passfile | ssh-add -p keyfile
That way, every time the shell starts, the agent includes your key with its passphrase.

GIT push with SSH

I am having create difficulty finding reliable information on creating SSH keys in order to remove the need for username and password when doing git push and pull for a main repo and separate nested repos.
To make sure I have no existing errors deleted them from
https://github.com/settings/keys
And then followed this guide which in a nutshell advises:
Check for existing, I deleted all from here as well
ls -al ~/.ssh
then (accepting defaults with no passkey)
ssh-keygen -t rsa -b 4096 -C "your_email#example.com"
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
clip < ~/.ssh/id_rsa.pub
and pasting key at https://github.com/settings/keys
The guide seems to end here, however attempt to push the repo gives:
fatal: HttpRequestException encountered.
An error occurred while sending the request.
Username for 'https://github.com':
What steps have been missed here please.
Attempting to push via git bash

SourceTree Terminal prompting for password but repo authentication is done via SSH

I'm running into an issue where whenver I try to open the terminal for a repository in Sourcetree and I perform a command e.g. git push, I am prompted for a password. The weird thing is that the repository authentication is done via ssh. The normal controls in the GUI work fine for pulling/pushing and doesn't prompt me for a password.
I have set up SSH configuration like so (which works fine for the regular Sourcetree GUI):
As per this thread with a similar issue: https://community.atlassian.com/t5/Sourcetree-questions/ssh-key-in-sourcetree-terminal/qaq-p/137178 I have copied the privkey.ppk to C:\Users\Niels\.ssh\.
Pageant shows the private key as being added too:
Why can I not perform Git operations on my repository from the terminal?
Git uses different format for keys than pagent and pagent is only usable for SourceTree not for Git system. You have to generate a new ssh key with ssh-keygen and you have to add that key to git server you want to use. Open a terminal (GitBash) and apply the following steps:
cd ~/.ssh
ssh-keygen -t rsa -C "your.email#example.com" -b 4096
cat id_rsa.pub | clip
Last command would copy the new public key to the clipboard. You can add it to Git server just bye pasting in the mentioned text box.

How do I make powershell stop showing this message whenever I push

How do I make powershell stop showing the below message:
github --credentials get: github: command not found
This occurs whenever I try to ssh for git push or git pull.
Check you git remote -v: it you see https, it is not an ssh url.
Make sure push or pull are using an ssh url with:
git remote set-url origin git#github.com:username/repo.git
If you are using https, Git will try and use a credential helper: see if git config -l | grep cred returns anything. That would explain the github: command not found part.
If you have, go to your repo and type:
cd /path/to/my/repo
git config credential.helper ""
If your git is recent enough (Git 2.9+), that will prevent any credential helper to be active in your repo.