How to link Smartgit to GitHub - github

I have a public GitHub account for the last year or so. Yesterday I installed SmartGit on my Windows 7 PC. SmartGit works fine locally but I'd like to push to a remote repo on GitHub.
When I look at SmartGit -> Preferences -> Authentication I have selected to use SmartGit as SSH Client. The 'Known Credentials' area is empty.
Under Hosting Providers I have added my github account [username+password] and Clicking on 'Login at GitHub...' it opens the browser and I am logged in successfully.
I would have assumed there would be something populating the Known Credentials area? I tried in vain in see if I had some key-pair stored somewhere that SmartGit could use. Eventually I downloaded PuttyGen and created a pair of keys. I gave them silly names to begin with but after some reading renamed them to *id_rsa* and "id_rsa.pub" and dropped them into my c:\users\MYNAME.ssh directory.
Still no sign of any credentials in SmartGit.
When I run the 'Remote -> Manage Remotes -> Add I enter the git name (based on the link I get from the github repo. I get the "Provide Credentials for authenticating to the SSH Server 'github.com' as user 'git'. The dialog box has pre-populated the Private Key File with the id_rsa I dropped into the .ss directory.
I even went onto github and added this key to the list of SSH keys. Still no joy.
Anyone any suggestions ?

Assuming it works similar on github and bitbucket.
Today I got Smartgit 3.0.10 running with bitbucket by the following steps:
To upload local code
1) Created the repository in bitbucket manually through the website
2) Add your ssh key to the website ( PuttyGen > Conversions > Export OpenSSH )
3) In your local repos check the contents of reposDir.hg\hgrc , should look like
[paths]
default = ssh://hg#bitbucket.org/user123/reposXYZ
if not change it manually. You can also clone your empty repos and the check in the
local copy for this line.
Restart SmartGit and you should be able to push and pull.

If you use the "HTTPS clone URL" on github, it makes a link that requires no SSH keys.
These 2 articles explain it:
https://help.github.com/articles/which-remote-url-should-i-use
https://help.github.com/articles/generating-ssh-keys

Related

How to push code to a GitHub Repo using Code Sandbox for iOS (2022)

I had trouble (even called support) and they could not answer correctly as to how to push code from CodeSandBox (iOS version) to a GitHub Remote Repo. I keep getting failed to connect (even using SSH and/either regular authentication). (They did lead me down part of the path)
The way that I finally got it to work:
Essentially you have to use SSH (not HTTPS - this will not work!!!! on iOS)
On GitHub
First create your repo on Github (private or public), I selected to create a private one
copy the SSH name address
git#github.com:yourusername/yourprojectname.git
In CodeSandbox,
Add your repo name in the git settings from above
In the SSH Settings, hit the magic wand at the top and let it generate the public and private for you (this was the key....), do not generate a key on your own at your command line (IT WILL NOT WORK)
In the private key passphrase (leave this blank)
Change your branch in the settings to "main" as you GitHub Repo points to
Back in GitHub
Go to your Repo, go to the settings for your repo (not on your account)
Go to Deploy Keys
Add a Deploy Key, paste in the public ssh-rsa key from your code sandbox (that you let it generate), Make sure you check the box "Allow Write Access)
Then you can now commit and push to your remote repository (Took me three days of troubleshooting to figure this out) -:)

Getting Can't connect to any URI (not authorized) error while pushing the commit to github repo [duplicate]

I recently did a push to my GitHub repository for a few weeks ago. I got a main from GitHub that GitHub is soon quitting regular authorization and going to replace it with another authorization method.
So today I push a new update to my GitHub repository and got the message:
git-receive-pack not permitted
That's leads to two questions:
Has EGit stopped working now?
I have Eclipse 2021-03, how can I fix this issue so I can do a push?
Since August 13, 2021, GitHub does not support authentication via HTTPS with your GitHub account password for security reasons anymore. Instead, in Eclipse, when pushing to a GitHub repository or when fetching from a private repository, you will get a git-upload-pack not permitted on 'https://github.com...' error.
As solution, use either
a GitHub specific Personal access tokens as password instead of your previously used GitHub account password or
SSH with an SSH key of which the private and public key is on your local machine and configured in Eclipse and the public key is uploaded to your GitHub account instead.
Personal access token (GitHub specific)
Go to your GitHub account to Settings > Developer settings > Personal access tokens website:
Click the Generate new token button in the upper right
Enter a Note, e.g. GitHub repo token
Choose Expiration, e.g. No expiration
Tick the checkbox repo
Click the Generate token button at the bottom
Copy the generated token to the clipboard
In Eclipse, in the Git Repositories view:
Right-click the Remotes sub-node for GitHub (origin or the name you have chosen when you have cloned the repository) and choose Configure Push...
Click the Change... button to change the URI in the upper right
Replace the password with with the copied generated GitHub token
Click Finish and Save to apply the changes
SSH
Create an SSH key (skip this step when you already have one):
In Eclipse, in the preferences General > Network Connections > SSH2 tab Key Management hit the Generate RSA Key... button
Hit Save Private Key... and choose a location, preferably the subfolder .ssh of your user home directory
Upload public key to your GitHub account:
For a new created key, copy the string shown in the Key Management tab to the clipboard; for an existing key add it in the preferences General > Network Connections > SSH2 tab General and copy the content of the public key file <name>.pub
Go to your GitHub account settings to the SSH and GPG keys section and hit the New SSH key button
Paste the copied public key into the Key field
Change HTTPS to SSH URLs of already cloned repositories:
In Eclipse, in the Git Repositories view right-click the repository and choose Properties and click the Open button
In the text editor of the config file change the remote URL as follows:HTTPS (old; does not work for push anymore):url = https://github.com/<username>/<repo>.gitSSH (new):url = git#github.com:<username>/<repo>.git
See also:
Video tutorial Import repository from Github to Eclipse using SSH
EGit User Guide
GitHub has disabled the HTTPS protocol
Most certainly not.
I push using HTTPS to GitHub without any issue, but I now have to use, as password, a PAT (Personal Access Token) instead of the GitHub user account password.
Make sure to create a new token, which will follow the new token format (March 2021)
ghp_ for Personal Access Tokens
I was using eclipse and git with ssh and had an issue with it using the wrong key.
When searching for the error: "Cannot log in at github.com:22"
It sent me to this answer: Cannot log in GitHub into Eclipse which ended up leading me to this one.
For anyone else that stumbles across this you need to navigate to
Window -> Preferences
Then from there expand
General -> Network Connections -> SSH2
Then in the right pane select the "General" tab and click the Add Private Key.. button and select the private key used for git. If you used a password for your key (which you should) then you should be prompted to enter it.
After this I could push and pull again no issues.
You need to create an app password or token to import the project from git/bitbucket. This token you need to use as a password.
Here create a token by giving the necessary permissions according to your requirements and create it.

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.

Can't push using EGit and Bitbucket

I've been trying to start a project using EGit with Bitbucket but I can't push the project to the repository in the server.
These are the steps I've followed (I'll try to be very specific so other people can use it as a tutorial mode; even though it's not working for me it might work for others):
1) I installed Git on Ubuntu 12.10 using this tutorial
2) Followed this tutorial for GitHub.
Start a new C++ project in Eclipse
Under Window > Preferences > General > Network Connection > SSH2 > Key Management tab, I generated a new RSA key and added it to the list of deployment keys of my repository on Bitbucket.
Right click on the eclipse project: Team > Share project ; Team > Add to index ; Team > Commit
Window > Show View > Other > Git > Git Repositories
Right click on Remotes > Create Remote > Checked "Configure push" and typed my project's name
Add Push URL: ssh://git#bitbucket.org/myuser/myrepository.git, Protocol: ssh; port: blank; user: git; password: blank
Advanced button under Ref mappings and selected the "master" version. If this step works, it means that the RSA key is configured in Bitbucket and EGit properly. Otherwise it will show a connection error.
Everything is done. However, when I press "Push" I get the following error:
ssh://git#bitbucket.org/myuser/myrepository.git: push not permitted
I've tried every configuration possible: switched to a new work space, updated Eclipse, created new repositories, re-installed Git... Any ideas?
Alright, I've finally found a way to work with it.
It's just changing the authentication mode. If the HTTPS link is used, instead of using the SSH link, everything works perfectly. It seems that SSH works just in a read-only mode.
Of course the authentication method is different: you have to type the password and the SSH keys stored in Bitbucket are no longer necessary.
For those who are having problems with EGit, I recommend following eugener's way to automatically configure EGit. Then you just have to select HTTPS as authentication mode to push the stored commits.
There is much simpler way of configuring remote Git repos in Eclipse:
Create an empty repo on BitBicket
Copy repo's URL
Clone repo to your machine using "Git Repositories" view.
Share your project into newly cloned repo.
Since a repo was cloned - remote settings were configured automatically. This means you will be able to push immediately
It might be a user name misconfiguration in .gitconfig.
Probably related, I fixed "auth fail" problems by following the instructions on:
http://wangpidong.blogspot.com.es/2012/05/how-to-use-bitbucket-with-egit-in.html
Got it from:
Configuring egit with BitBucket
In this specific case I agree with resolution from Olivier J.'s comment under original question.
But I have had similar problem and it was caused by something else. I resolved it and here is what happened:
I have been using some private repository at Bitbucket (A) with some user account and some public key (X) to access it. I have had key X loaded in my pageant Putty key chain.
Then I created a new public repository (B), also at Bitbucket with a different user account and another public key (Y). I added this key to pageant too.
When I tried to access repository B apparently public key X and not Y was used, because ..for SSH client both connections are the same - same user (git) at the same host (bitbucket.org)! And key X was used first because ..it was loaded earier? Or maybe because its name was alphabetically first? I am not sure but the result was that...
Read-only access for B using X was granted because the repository was public and any valid Bitbucket user key was enough to gain this kind of access!
..but writing (pushing) required key Y, which was not used by SSH.
So the general tip is: to resolve strange read-only git via SSH access errors check carefully which private key is actually used by SSH.
I resolved this problem by loading only one key - X or Y - in pageant at a time but I would love to do it a smarter way - please let me know in comments if you know how!
Using Bitbucket I do it this way:
create a repository in bitbucket
clone the empty repository using the https url
connect the project in eclipse to the repository using the Team -> Share option and select the location where you cloned the repo
index (stage) your project files
commit and push

Possible to Connect Netbeans with GitHub?

I know the Git integration is Netbeans 7.0 is new and under development, but has anyone had success on pushing/pulling to GitHub?
When I click Git->Push the remote repository url shows up correctly under Step 1. Configured Repository.
But is just stays stuck on " Connecting to repository". It also pops up a box saying "Specify Git repository location" with the exact same url , clicking OK does nothing.
If instead I choose "Specify Git Repository Location" I eventually get an error, "Cannot connect to the remote repository at git#github.com:username/..."
ps. I am aware of the other similar stack questions but they are confusing, one person mentions that he was able to do this, while others mention is not yet possible to use a remote Git connection.
I have had the same issue.
And now it works fine for me.
I have done this:
1 With CLI ( Terminal for me) Define your remote repo :
cd yourlocalfolder
git remote add origin git#github.com:username/repo.git
2 Open Netbeans (7.1 for me)
Go to Team > Git > Remote > Push
3 You should see your remote repo preselected
4 in Private /public key browse to your rsa file
usr/username/ssh/id_rsa
5 Click on Next
6 Done
You need check 'Specify Git Repository Location:'
'Repository URL:' https://github.com/<your username>/<yourGitFile>.git
'User:' <your username>
But is just stays stuck on " Connecting to repository". It also pops up a box saying "Specify Git repository location" with the exact same url , clicking OK does nothing.
I faced the exact same issue and after I did some research I found that the problem was with the password.
GitHub isn’t accepting passwords for Git operations anymore.
So instead of using a password, Github suggests using Personal Access Token.
Go to your Github account settings.
Go to Developer settings in the sidebar.
Go to Personal access tokens.
Generate new token.
Make sure to check repo scope checkbox to access your repositories.
After you get your access token you can copy it and past it in the password field in the "Specify Git repository location" window and try to push your project.