Can't upload Django project to Heroku - django

I'm making an app with Django and I want to upload it to Heroku but when I do
git push heroku master
I got this error and I don't know how to fix it.
! Your account myemail#gmail.com does not have access to fathomless-depths-4588.
!
! SSH Key Fingerprint: xx:xx:xx:xx:xx:xx:xx:xx:xx:02:xx:xx:79:xx:0f:xx
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
and I'm not using that mail "myemail#gmail.com" it's from an old project, I already use: heroku logout, and heroku login but it doesn't work.
I don't know is the SSH is important that's why I put it on xx xD!
I'll appreciate any help.

You should have a look at heroku-accounts - allows you to manage multiple accounts on the same machine.
https://github.com/ddollar/heroku-accounts.
Hope this helps.

Related

Bitbucket cloning into Linux server

I have read: BitBucket: Host key verification failed and Jenkins Host key verification failed and several other links provided. I seem to find myself in an odd situation.
I want to clone my django repo into a digital ocean droplet. I am following the steps of this document. https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04 .
Everything seems to have gone well, until the step where I need to create the django project. I already have a django project and thus don't want to create a new project on the server. I only need to clone it onto the server.
I ran : root#ubuntu-s-1vcpu-2gb-xxx:~#rsync --archive --chown=llewellyn:llewellyn ~/.ssh /home/llewellyn
My bitbucket has the id_rsa SSH key uploaded and it all worked in the past, no new SSH has been generated. And the repo is set to public.
When running:
(myprojectenv) llewellyn#ubuntu-s-1vcpu-2gb-xxx:~/myprojectdir$ git clone git#bitbucket.org:LlewellynHattinghLH/repo.git
Cloning into 'repo'...
Warning: Permanently added the RSA host key for IP address '18.205.xx.x' to the list of known hosts.
git#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have tried several articles, but most only tell me how to create a new SSH.
Any help would greatly be appreciated.
First, you can do:
export GIT_SSH_COMMAND='ssh -Tv'
Then the git clone will be more verbose, giving you more clues as to why it fails.
Second, regarding the permissions:
Your ~/.ssh must be 700, you keys 600: check that with ls -alrth ~/.ssh.
Note: what should be uploaded to your BitBucket is the id_rsa.pub public key, not the id_rsa private key.

Google Cloud Source Repository: remote: PERMISSION_DENIED: The caller does not have permission remote

remote: PERMISSION_DENIED: The caller does not have permission remote: [type.googleapis.com/google.rpc.RequestInfo]
Not able to clone, push the code into google cloud source repository. I have given "Project Editor" iam permission. I have successfully login with "gcloud login" command. I also have set the right default project configuration and account configuration using "gcloud config set project" and "gcloud config set account" commands. Please help me with this PERMISSION_DENIED error.
I had the exact same issue and I resolved it by adding a new entry in the .gitcookies file.
You have to manually generated and stored your Git credentials by login on this page: https://source.developers.google.com/auth/start?scopes=https://www.googleapis.com/auth/cloud-platform&state=
That will ask you to login with your account and allow Google Cloud Development wants to access your Google Account. Then, you'll have the script you have to run.
Hope this helps you as well.
For me it was that my free trial had ended and I needed to enable the billing here:
https://console.developers.google.com/billing/enable?project=[YOUR_PROJECT_ID]
For me this happened when I used SSH and connection re-use by a ControlMaster directive.
It seems like google's git implementation can't handle this.
For me either of these two worked:
close the ssh connection with ssh -O exit ... (add your connection)
delete the socket from the file system (specified by ControlPath)

Django website failing when using os.einviron.get for aws keys

I am using django, aws and heroku. I have a website that goes live locally when I have the following ids set.
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID","aaaa")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY","bbbb")
However, this is bad form because I can't commit this file to gitlab. If I did, my keys would be public (my gitlab repo isn't private yet, still practicing before I make that commitment) and all hell breaks loose. However, if I use the following code and try to go live locally
AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY")
I get the following error:
botocore.exceptions.NoCredentialsError: Unable to locate credentials
When I use the latter code and go live via heroku as an actual webpage it works.
It's as if my os.environ.get command doesn't work in my local settings. Does anyone konw what to do? I'd hate to have to change these lines of code everytime I want to commit to git or push to heroku. I feel like the 2nd code should work locally, but I don't see how.
check out django environ.
It let you set all your secrets in an environment file(.env), and read in your env vars to your django application.

How can I upload files to Amazon EC2 instance?

I managed to configure my website on a Linux ec2 instance with Drupal. But I don't know where I need to modify the files of the server. I already have a fully functional website on my local host and would like to upload it in my ec2 instance.
Can I upload my site somewhere in Drupal? I also tried without Drupal, I installed Apache, and everything but I can't add files on /var/www/ folder because I don't have the necessary permission.
Can you please give me some suggestions or tutorials that might help me?
You can change file permissions using terminal command.
As super user use:
chmod -R 777 var/www/
The -R makes it recursive. For security reasons it's not a good practice to give everyone access to var/www folder. Really consider do you want your filesystem to be so accessible.
My suggestion is to make sub folder and temporary give it full access while you migrate your site from local server.
chmod -R 777 var/www/folder_for_your_drupal_site
After you done with your local site migration you should change back permissions on Drupal default settings (pay attention on settings.php file).
For further info related with migration of local Drupal site check my answer here.
Hope this helps.

sent my application to different account on bitbucket

i sent my rails app to someone Else's bit bucket account using git by mistake.every time i try to create a new repository and send my app it asks me for that other persons account password.how can i undo this?
You can set correct account for you git repo, by following command:
git config --global user.name "Your Name Here"
You can see these steps in gitbucket help page.
Other this which can help you is gitcredentials by which you is used to manage credentials
from the user. More details for this command is here.
git config credential.https://example.com.username myusername