How do I push to Git Repo given the following error: An internal Exception occurred during push: ssh://git#github.com/xxx/xxx.git: session is down - eclipse

I recently set up a github account to store the source code of a project I have been working on.
I am using egit eclipse plugin to push changes to github.
I successfully pushed the initial code and 2 subsequent changes. However when I attempted to push the third change I was not able. The following excepiton appears in the eclipse error log.
If someone could tell me the cause of this error, or tell me how I can go about debugging the problem it would be a great help.
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of push command
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:156)
at org.eclipse.egit.core.op.PushOperation.run(PushOperation.java:227)
at org.eclipse.egit.ui.internal.push.PushOperationUI.execute(PushOperationUI.java:145)
at org.eclipse.egit.ui.internal.push.PushOperationUI$1.run(PushOperationUI.java:202)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.TransportException: ssh://git#github.com/xxx/xxx.git: session is down
at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:154)
at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:118)
at org.eclipse.jgit.transport.JschSession.exec(JschSession.java:91)
at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:306)
at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:152)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:130)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1120)
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:152)
... 4 more
Caused by: com.jcraft.jsch.JSchException: session is down
at com.jcraft.jsch.Session.openChannel(Session.java:750)
at org.eclipse.jgit.transport.JschSession$JschProcess.<init>(JschSession.java:147)
... 11 more

I experienced the same issue. Resolution follows:
Delete origin push and fetch in remote(Eclipse view --> Git repositories).
Close Eclipse.
Go to .ssh folder(Users/.ssh) and delete the key files(public and private).
Start eclipse and regenerate the keys(Window --> Preferences --> General tab --> Network connections --> SSH2).
Copy the key and add it to github/SSH Keys
In Eclipse add new remote and push.
Edit
You may not need to delete all the key files. If you have already added a key file previously (perhaps while setting up native Git), you can just add the name of that file in list of keys, and it will work.

This seemed to work for me:
Do everything Firoz and Nishant say except push: https://stackoverflow.com/a/9889350
Create or edit the following file on your desktop:
File : ~/.ssh/config
Content :
Host github.com
User [your_github_username]
Hostname github.com
PreferredAuthentications publickey
IdentityFile [path_to_private_key]
In your Eclipse Git Setup for your project do the following:
URI : git#github.com:[repo_owner_username]/[repo_name].git
Protocol : ssh
Username : git
Password : [leave_blank]
Save and push.
See this GitHub SSH Help page for useful info: http://help.github.com/ssh-issues/
Worked for me after initially suffering through "session is down" and "cannot open git-upload-pack" errors. Hope it helps everyone else too.
Good luck!

I faced the same problem and I found out solution which is extremely foolish.
I took following steps:
I logged into git repository of my project from browser and didn't sign out.
I copied the http url to push or pull from project repository from github.
I pasted the url in my eclipse plugin while pushing code (didn't use the already stored one even though both of them were same)
I don't know what and why but above steps have worked for me whenever I have faced above problem. I don't know why does eclipse throw such exceptions and why does it gets solved this way.
You can also try pushing using other ways outside of eclipse. for eg. `TortoiseGit` or `SmartGit` etc.

I had the same problem. I fixed it by pointing the JAVA_HOME variable to jdk 6. It was originally pointing to jdk 5.

I got this error message and it was fixed when one of my co-workers emailed me the two files id_rsa and id_rsa (MS Pub doc), I put them in C:Users\[userID]\.ssh, and shut down and restarted my IDE.

I had this issue with EGit and solved it at last. Somehow sometimes things get messed up. If you can not solve it through Eclipse just go to your "git" folder with git bash with Windows. With Linux it is even easier: just open the terminal.
This problem occurs because of username, password, and ssh keys getting messed up.
So, use the commands "git remote show origin" and make sure if the origin is username#github.com...... Sometimes Eclipse just puts "git" as a username so make sure you have the correct user name by changing it with the command git remote set-url origin https://usrname#github.com/restofthe url. It should automatically change the configurations in eclipse.
Best...

I also had this issue.
The following command in Git Bash, comes handy in such scenarios: git remote prune origin
This configured the Pull/Push in the corrupted branch.

Related

cannot get remote repository refs in eclipse

Introduction:
Main Repo: Repo1.
After forking it, my repo is : ForkedRepo1
In Eclipse-Git, I cloned my ForkedRepo1.
Until Thursday, I was able to commit & push without any issue.
Then suddenly, on Thursday, I got the error:
Cannot get remote repository refs
Reason:
ssh://<forkedrepo1: session.connect:
java.netSocketTimeoutException: Read timed out
I have a SSH key.
Nothing as altered in my system, so I am not sure what happened.
To make matters worse, I deleted my Remote(origin) in eclipse-git and when I try to add it back, I get the same error - java.net.SockettimeoutException: Read timed out.
However, via git bash, I can commit a file and push it to the local branch in GitHub.
I hope this info is enough to give me some idea.
FYI: I am working on a existing project, so when I push a file up for review, it worked successfully. It is just that I cannot now do it in eclipse.
Then try, as described here, to switch to an HTTPs URL.
You can then cache your GitHub credentials (GitHub username/password) in a credential helper, generally already configured (see git config credential.helper)
It is probably caused by the removal of weak cryptographic standards.
You need a recent Java 8 revision (i.e. 1.8.0_161), a recent version of EGit (such as 4.10.0.201712302008-r) and you probably need also to restart (just once) Eclipse with the -clean parameter.

Sourcetree error : 'git status' failed with code -1073741819

Started getting following error in Sourcetree suddenly. I dont know what is the reason behind it. but I am nit able to resolve it.
Not able to perform any operation.
I ran into this as well. I followed the steps here and it solved my problem:
https://jira.atlassian.com/browse/SRCTREE-2018
Specifically:
Using the terminal and changing your directory to your repository you can do the following (making sure you back up your repository first, just in case):
rm .git/index
git add .
Or if you have changes in your working directory you want to keep you can do the following:
rm .git/index
git reset HEAD .
I had the same issue and it was not fixed even if I deleted the .git/index and .git/index.lock file.
I had to go to SourceTree Options -> Git and select "Use Embedded Git" to make it work. Before it was "Use System Git".
This is happening because Git was installed and then SourceTree with Git inside.
This generated a conflict between the two installed GITs.
You need to uninstall Git or in the SourceTree installation point where it is installed.
I'm facing with the same issue. My software configuration is:
Windows 10
SourceTree 2.0.18.1 configured to use System Git version
Git v2.12.2.windows.1
I updated Git to v2.12.2.windows.2 (the latest build) and the problem
disappeared.
Try doing this
close Sourcetree window
open Sourcetree Bookmarks view
delete bookmark
add bookmark again

Issue with SourceTree while cloning a GitHub repository

I know that similar questions have already been posted here. However, I think my scenario is a bit different. Here is what I have.
I downloaded and installed the latest official version of the SourceTree software. Also, I have a GitHub account with permissions to clone and push the repository. In order to manage a local copy, I need to clone the online version. Here are the steps that I take:
Start the SourceTree and navigate to File -> Clone / New ...
In the opened window I paste the HTTPS clone URL. I copied it from the browser after I logged in to my GitHub account so the link is correct.
The nest step is to specify a local folder where the repository will be copied. However, when I click to enter Destination Path, the window shows an error:
This is not a valid source path / URL
Clicking the error may give the following details:
remote: Repository not found.
fatal: repository 'https://github.com/org/repo.git/' not found
remote: Repository not found.
fatal: repository 'https://github.com/org/repo.git/' not found
Or the details may be empty. SourceTree does not tell me the reason for the error or anything else.
I tried to re-install SourceTree but the error still exists. I asked the Administration of the GitHub repository for any other permissions but my account has all of them. I am able to push changes to the online repository using the Terminal console but I would like to use a UI (that SourceTree provides) to manage and compare changes in the code.
One think I did not try is to clone the repository using another GtHub account. However, I don't want to do that because I need to commit any changes to the repository on my behalf.
Does anybody know how can this error be fixed or worked around?
I was facing the same issue in Sourcetree for macOS:
This is not a valid source path / URL
The following solution worked for me:
Sourcetree > Preferences > Advanced
Remove the Host name
Clone the project again in Sourcetree
A prompt will pop up; enter your git credentials.
That's it, it resolved my issue.
Lastly on Mac I went to
Sourcetree->Preferences->Git->Git version->Use System Git
and it works... puf!
The exact error message is (as illustrated here):
This is not a valid source path / URL
Possible cause:
proxy settings (as in this thread)
setup steps, with Git disabled (as in here)
When SourceTree started for the first time, I skipped setting up Git & Mercurial in the wizard. Then I reran the wizard and chose to download and install the embedded packages.
But it seems installing those didn't actually enable them - in the Tools -> Options dialogue they were both disabled!
Enabling Mercurial (or Git in your case) allowed the clone dialogue to correctly identify the repo.
credential issues (as in here, from my old answwer)
So I'm here in 2021. Previous answers didn't work for me. There is an issue with a SourceTree (to be honest a lot of issues actually) and as a workaround you can use a token as a password to connect to GitHub.
Use this url to create it: https://github.com/settings/tokens
I hope it helps! 🙂
I was facing the same issue with windows 10 and source tree. After bit research following solution worked for me.
I needed to download or enable the git support in source tree.
Steps
1) Go to Tools -> Options -> Git -> Enable git support
That's it it resolved my issue. Happy coding :)
I was facing the same issue in mac. The following solution worked for me :
Generate personal access token in Github using the following steps :
Login to Github account -> Settings -> Developer Settings -> Personal
access tokens -> Generate new token -> Enter token name -> Generate
token
Sourcetree > Preferences > Advanced
Remove the Host name
Clone the project again in Sourcetree
A prompt will pop up; enter your git credentials. (enter username and in
password enter newly generated access token)
After following this steps, Clone option will get enabled
May I also just add that I resolved this issue by installing Git through SourceTree from [SourceTree]>Tools>Options>Git.
As I'd been using mercurial exclusively on that system till then it had never been installed, and so was presenting the above described error when trying to clone.
Hopefully this helps someone with the same issue! If not, good luck!
I was facing the same issue with windows 10 and source tree. After bit research following solution worked for me. I needed to download or enable the git support in source tree.
Steps 1) Go to Tools -> Options -> Git -> Enable git support
That's it it resolved my issue. Happy coding :)
Even tried all the options above, It quite dint work for me.
I disable the option of ssl certificate
steps :
Go to Tools -> Options -> Git. check the box of "Disable SSL certificate validation"
It worked for me.
Open source tree Tools -> Options -> Git -> Update Embedded. While updating it will ask your gitlab account for linking. After that restart your system.
Adding my scenario and solution:
I have two factor authentication turned on. I couldn't see some private repositories, and couldn't clone from URL. The error I saw was:
remote: Repository not found.
fatal: repository 'https://github.com/bizzabo/web-common.git/' not found
remote: Repository not found.
fatal: repository 'https://github.com/bizzabo/web-common.git/' not found
Supposedly newer versions of SourceTree don't need a personal access token because they can authenticate directly with github, but I couldn't get this to work.
Apparently OAuth and 2FA don't mix well together -- so I changed the authentication method from oauth to basic and used the access token I generated. That did it.
Just in case someone who has multiple git accounts connected and faces this issue, I solved it by going to Tools > Options > Authentication and marking the account which has access to the repo you are trying to clone as default.
Install git to your system by browser and then go to the source tree, click on
Tools -> Options -> Git
then scroll down and click on system.
It works for me, I hope for you too.
I had to uninstall and reinstall SourceTree before it would work. I think my antivirus (Comodo ) was blocking/sandboxing some stuff on the initial install so I disabled it for the reinstall.
I had also same issue This is not a valid source path / URL and it got resolved by updating the Embedded Git of Source Tree.
This issue also manifested itself where I couldn't push or pull from previously cloned and working repositories in source tree. I complained about authentication username and password but clearly that was not the case.
Steps to resolve:
Open source tree, Tools -> Options -> Click on Git Tab -> Update Embedded Git.
I had the same problem. My resolution was to commit an initial file into the repo. After that, I could clone the repo to my desktop.
options -->Tools--->disable ssh worked for me in Mac
The issue might be because of SourceTree didn't have all private access from Github
I have answered here please check to avoid the duplicate answer posting reference link
https://stackoverflow.com/a/62145210/4328589
If you are using Mac and there is Keychain access handling all your authentication, then delete the entry for stash/git url. Now try to checkout in sourcetree and it will ask to enter the password again.
That will solve your problem.
I face this issue on Windows 11 and following are the steps worked for me :
Click on Open with GitHub Desktop option [Refer below image]
Download & install
Launch and click on Open in browser with Github.com
Enter your credentials & validate
Now, Open SourceTree
Click on Tools > Options > Authentication
You will see your Git credentials were successfully added in SourceTree & you can proceed with any option like clone repo etc
I was trying to clone a project from gitlab. However, I have cloned gitlab projects earlier with an account/user credentials which is different from the new account I want to use. In this case, I had deleted the credentials for the old account and then I was able to clone the project by entering credentials for the new gitlab account. To delete the account on MAC go to Preferences > Advanced > Select the account to remove > Click remove.
In my case i was doing new Mac book setup.
Without installing Xcode i was trying to clone branch using SourceTree.
After Xcode installation done, branch cloned successfully.
SourceTree asked for system password for cloning.
I'm posting another possible solution, as I just helped a colleague who couldn't clone a private repo belonging to a GitHub organization even though he had been given the correct level of access.
Check the Windows Credential Manager, especially if you've been using the same machine for some time or have connected to different accounts.
Git may be picking up the wrong credentials without you realizing it, and that's why it can't find the repo.
To be on the safe side, delete all the credentials that have to do with git/github. You'll know you have done it properly and are starting from a fresh state when you will try cloning again and git will ask you to authorize it through your browser.
probably you try the wrong account only add this
account.name# to link
you can learn it from your GitLab account
https://account.name#gitlab.com/samrak-growth/samrak-app-backend.git
In my specific case (setting up a new mac) the root cause was a "missing xcrun" meaning the local dev tools wasn't activated, and the local git client can't run properly.
that was my fix
xcode-select --install
In my case I had used SourceTree's "Add account" setting to add my Bitbucket and GitHub accounts to SourceTree under the SSH protocol. SourceTree did everything correctly to generate SSH keys and add them to my machine but it made a slight mess of the entries that it added to my ~/.ssh/config file. It created entries as follows:
Host username-Bitbucket
HostName bitbucket.org
User username
PreferredAuthentications publickey
IdentityFile /Users/adil/.ssh/username-Bitbucket
UseKeychain yes
AddKeysToAgent yes
Host username-GitHub
HostName github.com
User username
PreferredAuthentications publickey
IdentityFile /Users/adil/.ssh/username-GitHub
UseKeychain yes
AddKeysToAgent yes
The Host values it generated are incorrect. I changed the entries in my ~/.ssh/config file to the following:
Host bitbucket.org
User username
PreferredAuthentications publickey
IdentityFile /Users/adil/.ssh/username-Bitbucket
UseKeychain yes
AddKeysToAgent yes
Host github.com
User username
PreferredAuthentications publickey
IdentityFile /Users/adil/.ssh/username-GitHub
UseKeychain yes
AddKeysToAgent yes
After making this change, the "This is not a valid source path / URL" error went away and I was able to clone repositories from my Bitbucket and GitHub accounts without problem.
I removed and added my account again using the HTTPS rather than SSH URL.

Github windows: Commit failed: Failed to create a new commit

I have: http://windows.github.com/
My current project has around 20k files, around 150MB (and not speaking about how slow it is and I cannot do a thing now) it doesn't even let me commit! I get this error: Commit failed: Failed to create a new commit.
That seems that nobody is having.
I've already deleted the folder and cloned again, no escape. What to do?
If I choose to open shell, all this *** crashes!
Edit:
Since the problem I've switched to Git Extensions and I didn't look back!
thanks for your answers
This happened to me. Try opening up PowerShell and manually committing each file using the "git add [file name]" command. To see which files have been added, enter "git status" into the command line. The green files have been added, the red ones have not been added.
Once you've added them all, type "git commit." Then go back to Github for Windows and sync it up.
I'm not sure what causes this issue, but once I followed the above steps, Github went back to its normal, awesome behavior.
I had this problem too after an unexpected crash. I couldn't fix using the 'Open Shell' option as suggested. I had to open the Windows CLI (Start -> run -> cmd) and delete the index.lock file in my GitHub folder:
cd \Users\myUser\my\local\github\repo
cd .git
del index.lock
Then when I went back to the GitHub app, it committed successfully.
Note that for some people, according to comments, the file to delete doesn't have the .lock extension, so the delete command could also be del index.
Im using Githug for Windows (7) and faced the same problem. While using PowerShell I realized that I didn't fill Full Name and email address in tools > options. Look like a beginner mistake (and I am!).
hope it helps!
just try to commit a few from your updates. 5 for example. and then make another commit with all other updates.
I am using windows client and getting the same error. Then suddenly I realized that my local db in app_data was opened on the SQL management. It just simply can't commit the some files to github if they are opened or using at the other programs.
Just disconnected management studio closed it and just simply committed.
This may be your case also. Check your files out!
So guys this is the full steps I had to take in order to fix the problem...
1) Using Process Explorer (you can download it form here http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) I searched for any process referencing ".git\index" and then I killed it.
2)Then using Git Shell (Windows Power Shell) I went into the repository which was giving me such difficulty and then furthermore went into its .git folder. (cd .\your_respository_name\.git). I then removed the index.lock file in that directory (rm -r index.lock).
3)Then from within that same directory I ran git reset HEAD.
4)Then I manually committed each file using the "git add [file_name]" comand. (You can check that they were added successfully if when you run git status, the files are green.
5)Next run git commit if your files are added correctly.
6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.
This issue seems to be a bug in the github client - I get it "all the time" on the machine on which i only installed the github client.
I Never saw it on the git + github PC (I have not used it for a few days now).
Doing the "git add ." and then "git commit" worked for me also on the shell - but that is the thing the GUI should be doing not me - otherwise I can just stick to the git shell client.
Had the same problem, couldn't commit or sync using the windows GUI, but I could commit the changes through the shell. Once I'd added the changes through the shell the windows GUI started to sync normally. Hopefully it's a one off.
I had an interesting issue - even though I had an excel file open called "Combined - ForImportv4.xlsm", Git UI had no problem checking that in but it gave the error in the OP's subject for the backup file "~$Combined - ForImportv4.xlsm" so I discarded that change and all went through.
PS: As for why i'm checking an Excel file into Git ... just don't got there :)...
I had this issue with the git windows desktop commit tool. I was getting this often and I figured out that Visual Studios was locking the files. To get around this issue I simply closed visual studio and the commit / sync worked fine.
I googled failed to create repository and ended up here.
My problem was that the description for my new repo was too long. There is a charlimit for the description, but GitHub tried to push it anyway and failed.
I just had the same problem, tried some of the suggestions on this post but none worked so what i did was, on the GiTHub client i went to tools -> settings and then click on the section where it says add/create default ignored files. Then hit Update and try to commit again through the client.
It happend to me when my project was opened in an IDE (Netbeans in my case), make sure non of the files you're about to commit isn't open in some program.
I checked the log file at C:\Users{user}\AppData\Local\GitHub\TheLog.txt and found this error:
LibGit2Sharp.LibGit2SharpException:
Could not open 'SomePath\SomeProject.opensdf':
The process cannot access the file because it is being used by another process.
I closed Visual Studio and the commit was then created successfully.
n.b. I removed actual file path in the above error.
If you are new user make sure that you have confirmed your e-mail. Had same problem and confirmation fixed it!
You can manually navigate to index.lock which is found inside the hidden .git folder of your repository location. Once you delete index.lock you will be able to commit as per usual.
The easiest way to navigate to the folder will be to click on the folder breadcrumbs inside windows explorer and add \.git and press enter.
Just delete 'index.lock' in the '/.git/' directory. Solved the problem for me instantly.
I had this happen to me and this is the easiest way to fix it:
Make a copy of your local folder that has the repo and remove the .git folder form it.
Delete the original repo folder with files.
Re-clone the repo from GitHub with the Windows client.
Delete all of the files that get cloned except for the .git folder.
Copy all files from the copied folder into the new clone folder.
Add in your commit notes and the commit should work this time.
I had the same problem and I fixed it by renaming one of the file because its name was too long. This fixed the problem.
Here is error message from git shell:
fatal: unable to stat 'plugins/com.napolitano.cordova.plugin.intent/example/app/platforms/android/CordovaLib/build/intermediates/classes/debug/org/apache/cordova/NativeToJsMessageQueue$OnlineEventsBridgeMode$OnlineEventsBridgeModeDelegate.class': Filename too long
I REBOOTED my Windows 7 machine and tried again - IT WORKED!
I had the "Commit failed: Failed to create a new commit" and tried to delete the index or index.lock file via windows command prompt and that didn't work. I deleted it via windows explorer, that didn't work.
I tried to check credentials like another reply in this list said, but couldn't figure it out and the credentials seemed 'ok.' So - I rebooted. Viola.
I'm not sure this will help anyone, I'm not all that great w/ this stuff, but trying.
I deleted ".git" in children directory and the problem was resolved.
It happened to me once ,I had a empty repository inside of the repository that I cloned.
It was a silly mistake though but could happen .

An internal Exception occurred during push: cannot store objects

Hello I am new to Git and trying to setup server part and client part.
On a Server side I have ssh access and Git version 1.5
On a Client side I have eclipse with eGit.
I created git repo on a server side via usual means: git init and added simple html file.
Using eGit I checkout the repo and everything seems to be going well. I made changes on a client side, committed it and decided to push back to the server.
Now I have all permissions set but still get following error:
I don't know how to fix it and error message doesn't provide much details.
Please help.
Thank you!
For me, on Windows eclipse, I had an error like this:
An internal Exception occurred during push: github.com/***/***/service=git-receive-pack not found
I just reconfigured the eclipse and added my github account information and store it. Then it worked. Team->Remove->Configure push to upstream->URI, Change->Add authentication details
Ok, I resolved my issue following way:
1) I changed configuration for remote fetch and pull from sftp to ssh
2) Once I did step 1. I got different error:
When I tried to push changes from Terminal I got following:
git push origin
Password:
bash: git-receive-pack: command not found
fatal: The remote end hung up unexpectedly
3) Found answer to the above error: git-upload-pack: command not found, how to fix this correctly
4) On my old server path to the git is: "/usr/local/git/bin" So I added it to .bashrc file.
Once I done that, everything started to work:
The possible issues are:
1. The source code might not be committed in the first place. Please try committing and see.
2. There is some issue with github authentication. Please re authenticate the credentials and try using: Team->Remove->Configure push to upstream->URI, Change->Add authentication