How to switch Intellij Idea project vcs between Gitlab and Amazon CodeCommit? - intellij-idea

I am new with Amazon codecommit.
Following their instruction, I did some works like below
make a new IAM user with AdministratorAccess
make a new codecommit repository
install awscli and did aws configure
When I right finished those things, I could pull/push from codecommit.
However it became disabled with intellij Idea.
I did something like...
I pull a project from gitlab
git remote rm origin
git remote add origin [code commit url]
git branch --set-upstream-to origin/master
Now I type git [pull / push] origin master, I got this error message.
unable to access 'https://git-codecommit.ap-northeast-1.amazonaws.com/v1/repos/test17/': The requested URL returned error: 403
When I access this url via browser, it requires id/pw. But my IAM user account information is not working.
What should I do? Is there any way to switch gitlab and codecommit in intellij?
Thanks.

IntelliJ does not use awscli. It uses the default system shell.
From the description, it looks like push/pull does not work for the command-line git in the native shell, so the issue is not IntelliJ-related.
Probably git tries to use wrong credentials save in its credential.helper, that is why it fails.
Check git config credential.helper to see if any is configured. If there is one, try disabling it or clear the saved credentials.

From the description it looks like you are trying to connect to a CodeCommit repository in Intellij using https. To do this you need to generate GitCredentials(username/password) for your iam user in the IAM console.
Detailed steps are documented in the aws documentation: http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html
Once you have the username/password you can use those credentials to connect to your CodeCommit repository in Intellij.

Tested on a Mac. Your milage may vary!
I just ran into the same issue. MacOS stores the GIT UID and PW in the Keychain (in your Applications > Utilities Folder). I deleted all references to AWS Code Commit from the keychain, which forced me to reenter the UID & PW. This seems to have solve the problem.
As a side note: I think this happened because I revoked a prior GIT credential on AWS and created a new one. I think that the keychain was entering the old UID/PW which then failed during authentication.

First, you are going to want to create an IAM user with appropriate permissions and then create Git credentials. Then go to IntelliJ IDEA and say you are opening project from VCS with Git credentials, use the AWS git credentials you created and log in. Once you have logged in, you should be able to pull/push to the repo. If you are still having issues and have checked the credentials you are using are active, along with the IAM user those credentials are attached to have the right permissions, I would recommend creating a ticket on AWS support as there may be something wrong with your account that AWS staff will need to fix.

Related

How to push Fossil local repository to remote hosting

It would be great if you could help me with one thing.
I'm using Fossil as my version manager. Using this on my PC is not a problem but when I try to push it to remote repository I can't.
Here's the thing:
When inside folder with my repository I type
fossil push https://chiselapp.com/user/sebatbg/repository/nres
I get info that:
Error: Wrong project
When I type
fossil push https://sebatbg#chiselapp.com/user/sebatbg/repository/nres
It asks for my password but when I enter it fossil says that Login failed
I tried both my pass to chisel app and for specific repository but result is the same.
Could anyone tell me step by step how to do the push?
Thank you
Fossil assigns a unique ID, called the "project ID", to each new repository. The error message "Wrong project" means that you've got different repositories locally and remotely, that their project-IDs don't match.
The only way I know to publish an existing local repository on Chisel is to upload said repository, and then set the remote-url of your local repository to the Chisel URL, either explicitly or by pulling from the URL.
I had a similar problem. I had cloned a remote repository, but could not push to it.
I could solve it by adding the username to the remote url
remote-url https://{username}#chiselapp.com/user/{chiselab-user}/repository/{repository-name}
you are then prompted for the password of the remote repository.
If you have an existing local repository that you would like to upload to the chiselapp hosting service, the process can be a bit awkward. If your repository is smaller than 8M, chiselapp provides a command Upload repository that may suit your purposes. Otherwise, this is what you need to do:
Navigate to a source tree for the local repository.
Issue the fossil info command and copy the project-code of the local
repository. This is a SHA1 hash.
Log in to chiselapp.com website and click on the Create Repository
link in the header of the home page.
Paste the previously copied project-code into the Override Project Code
field of the resulting form.
Fill the remaining fields as appropriate and click the Create Repository
button at the bottom of the page.
Record the password that is then assigned to you.
Navigate to the chiselapp dashboard and click on the name of the newly
created repository. This should bring you to the fossil web interface of this repository.
Login to the new repository using your local username and the recorded
password. This should be the only user so far and should have setup user permissions.
Navigate to the Admin/Stats page and check that the Project ID of the new
remote repository matches the project-code of the local repository.
Back in the local repository's source tree issue the command
fossil push https://<username>:<recorded-password>#chiselapp.com/user/<username>/repository/<repository-name> -R <local-repository-file>

How to configure Bitbucket app password with SourceTree?

I enabled two-factor authentication in Bitbucket, then created an app password. Where should I configure this app password in SourceTree?
Please follow the below steps suggested by Atlassian -
Source: https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/
For anyone finding this in 2021, another alternative (If you've been using other Bitbucket repositories all the while without having this problem). My issue is that I still had a very old repo still using the HTTPS git URL.
For example, issuing git remote -v in my legacy repository revealed something like:
origin https://myusername#bitbucket.org/myusername/myrepository.git (fetch)
origin https://myusername#bitbucket.org/myusername/myrepository.git (push)
Simply take the SSH version of your repository instead and set it with (using above url as an example):
git remote set-url origin git#bitbucket.org:myusername/myusername.git
You can do a sanity check by issuing git remote -v again to confirm that the new origin URL has been set.
Once this is set, you should be able to push to your remove without issues.
Simply use your app password instead of your account password when you configure the repository.

Pass username and password for git pull

is there any way to provide username and password for git pull as command line arguments? in svn there was something like:
svn up --no-auth-cache --username $SVN_USER --password $SVN_PASSWORD
Is there any equivalent of this in git? I can't store the credentials on the filesystem.
Basically, I have a script running build for multiple correlated projects. Because the script is on a shared server and is to be run by different users, I can't store the credentials on the server. I don't want to prompt the user, because the script fetches data from multiple SVN/GIT repositories with single username/pass so I want to read the credentials once via the script and then pass them to git pull or svn up commands
If you're using HTTPS, a solution might be in this answer:
The not secure way is to include credentials in the url you're pulling, https://user:password#server.com/path/to/repo. Apparently, your credentials end up as plain text in the .git folder and/or in log files.
The secure way is to configure a "credential helper" in git. Then it will remember the credentials once they're used. It will store the credentials securely on the machine, but if you use the system-wide configuration they will apply to all users. For example, with msysgit on Windows I'd use the wincred helper: git config --system credential.helper wincred. My understanding is that --system turns the credential helper on for all repositories and all users on the system, so you'll have to decide if this is okay for your server. Disclaimer: I've only used --global before.
I haven't seen better options for your situation, but some of the real git gurus might chime in.

Authentication failed publishing a repository from Github for Windows

I am trying out Github for Windows and I am getting the following error when I try to publish a newly created repository.
Authentication failed
Your credentials may be out of date. Please log out of the application and then log back in before retrying the operation.
Needless to say I've logged out and back in multiple times without success. I've also uninstalled and installed the latest version to no avail.
The repository is a new one I created within the application and contains only the .gitattributes, .git and README files.
I am a complete newbie to Github so it's quite possible I've messed something up during the setup process.
I was able to solve this by:
Press Settings - Open in GitShell.
git status
git push (or pull)
introduce credentials (here is the most important step, somehow git client messed up or forgot your credentials).
After giving correct credentials you can exit from git shell and use git client again.
It turns out that the problem was Github for Windows was having a problem with the password it had stored. Github support's instructions were as follows:
Log out of Github for Windows.
Change my password on github.com
Log back into Github for Windows.
I was then able to publish my changes.
Did you setup your ssh keys?
https://help.github.com/articles/generating-ssh-keys#platform-windows

Clone private Mercurial repository on bitbucket.org into InetlliJ IDEA with hg4idea plugin?

I created private repository on bitbucket.org. I want to use it from IntelliJ IDEA.
I choose "Check out from Version Control" and there is message box with field Mercurial Repository URL and Test Repository button.
What should I enter into Mercurial Repository URL?
I tried
http://bitbucket.org/my_user_name/my_repo_name,
https://, and https://my_user_name#bitbucket.org/my_user_name/my_repo_name.
Nothing works.
When I click Test Repository I always get the message "Repository test has failed.".
I assume it is because there is no field for username and password, but can't I enter this data somehow?
Since only the latest hg4idea version supports authentication, you could try, for accessing and cloning your Bitbucket repo:
hg clone http://myuser:mypassword#bitbucket.org/MY_USER/MY_REPO
(that is, if your Bitbucket repo is a private one, which you did mention in your question:
'myuser' and 'mypassword' would then be the login and password for your Bitbucket account, using basic access authentication for the http url)
I was able to get this working by cloning the repository via a command-line prompt using the command that BitBucket gives me on my overview page. After doing that and activating version control on the project in IDEA, IDEA allowed me to push and pull from the repository successfully.