[SOLVED] Git from 2 repository with different gitignore
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I pull a repository from a person and I want to push to my own repository because something change and I want to use different gitignore file. How can I do it? Thanks, and I want to use github and bitbucket both. Then is it possible. Thanks.
It's definitely possible - you'll just have to set up two different remotes: one for gitlab and one for bitbucket. However, having two different .gitignore files is going to be somewhat tricky. I've never found a good way to do that. The best way might be to create two different branches in your clone (one with bitbucket as the origin and one with GitHub). These two branches can have different .gitignore files. The problem will be making sure changes to the .gitignore files are not overwritten when merging between the two branches. However, you can always revert any changes to .gitignore after merging.
There may be an easier way to do this, but if so I have yet to find it. Why do you need two different .gitignores? I presume you want to keep some files out of one or the other remote, but for what purpose?
Acutally, I use one person's emacs configuration and of course I add some plugins for my own. In his configuration, there are many files ignored. But I just want to push all things to my own repositary. And I am afraid when I pull from his configuration when he updated, it might overwrite the .gitignore. That is the reason.
I have never tried, but probably you can put .gitignore itself into .gitignore and you will have your own private copy. Other solution can be to use symbolic link instead of file, pointing outside of the repo.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.